Browse Source

adjusted guide renderer to new guide structure

tags/2.0.0-rc
Carsten Brandt 11 years ago
parent
commit
39a2e1efd7
  1. 3
      extensions/apidoc/commands/GuideController.php
  2. 11
      extensions/apidoc/templates/bootstrap/layouts/guide.php
  3. 2
      extensions/apidoc/templates/bootstrap/layouts/main.php

3
extensions/apidoc/commands/GuideController.php

@ -83,9 +83,6 @@ class GuideController extends BaseController
*/ */
protected function findFiles($path, $except = []) protected function findFiles($path, $except = [])
{ {
if (empty($except)) {
$except = ['README.md'];
}
$path = FileHelper::normalizePath($path); $path = FileHelper::normalizePath($path);
$options = [ $options = [
'only' => ['*.md'], 'only' => ['*.md'],

11
extensions/apidoc/templates/bootstrap/layouts/guide.php vendored

@ -14,11 +14,16 @@ $this->beginContent('@yii/apidoc/templates/bootstrap/layouts/main.php'); ?>
<?php <?php
asort($headlines); asort($headlines);
$nav = []; $nav = [];
foreach ($headlines as $file => $headline) {
if (basename($file) == 'README.md') {
$nav[] = [ $nav[] = [
'label' => 'Index', 'label' => $headline,
'url' => $this->context->generateGuideUrl('index.md'), 'url' => $this->context->generateGuideUrl($file),
'active' => isset($currentFile) && (basename($currentFile) == 'index.md'), 'active' => isset($currentFile) && ($file == $currentFile),
]; ];
unset($headlines[$file]);
}
}
foreach ($headlines as $file => $headline) { foreach ($headlines as $file => $headline) {
$nav[] = [ $nav[] = [
'label' => $headline, 'label' => $headline,

2
extensions/apidoc/templates/bootstrap/layouts/main.php vendored

@ -64,7 +64,7 @@ $this->beginPage();
} }
if ($this->context->guideUrl !== null) { if ($this->context->guideUrl !== null) {
$nav[] = ['label' => 'Guide', 'url' => rtrim($this->context->guideUrl, '/') . '/' . BaseRenderer::GUIDE_PREFIX . 'index.html']; $nav[] = ['label' => 'Guide', 'url' => rtrim($this->context->guideUrl, '/') . '/' . BaseRenderer::GUIDE_PREFIX . 'README.html'];
} }
echo Nav::widget([ echo Nav::widget([

Loading…
Cancel
Save