From 39a2e1efd72c75fcd68432cce7949fd01dca8b37 Mon Sep 17 00:00:00 2001
From: Carsten Brandt <mail@cebe.cc>
Date: Sun, 4 May 2014 07:04:43 +0200
Subject: [PATCH] adjusted guide renderer to new guide structure

---
 extensions/apidoc/commands/GuideController.php          |  3 ---
 extensions/apidoc/templates/bootstrap/layouts/guide.php | 15 ++++++++++-----
 extensions/apidoc/templates/bootstrap/layouts/main.php  |  2 +-
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/extensions/apidoc/commands/GuideController.php b/extensions/apidoc/commands/GuideController.php
index d0450b1..681f5de 100644
--- a/extensions/apidoc/commands/GuideController.php
+++ b/extensions/apidoc/commands/GuideController.php
@@ -83,9 +83,6 @@ class GuideController extends BaseController
      */
     protected function findFiles($path, $except = [])
     {
-        if (empty($except)) {
-            $except = ['README.md'];
-        }
         $path = FileHelper::normalizePath($path);
         $options = [
             'only' => ['*.md'],
diff --git a/extensions/apidoc/templates/bootstrap/layouts/guide.php b/extensions/apidoc/templates/bootstrap/layouts/guide.php
index 7ef2491..d45a982 100644
--- a/extensions/apidoc/templates/bootstrap/layouts/guide.php
+++ b/extensions/apidoc/templates/bootstrap/layouts/guide.php
@@ -14,11 +14,16 @@ $this->beginContent('@yii/apidoc/templates/bootstrap/layouts/main.php'); ?>
         <?php
         asort($headlines);
         $nav = [];
-        $nav[] = [
-            'label' => 'Index',
-            'url' => $this->context->generateGuideUrl('index.md'),
-            'active' => isset($currentFile) && (basename($currentFile) == 'index.md'),
-        ];
+        foreach ($headlines as $file => $headline) {
+            if (basename($file) == 'README.md') {
+                $nav[] = [
+                    'label' => $headline,
+                    'url' => $this->context->generateGuideUrl($file),
+                    'active' => isset($currentFile) && ($file == $currentFile),
+                ];
+                unset($headlines[$file]);
+            }
+        }
         foreach ($headlines as $file => $headline) {
             $nav[] = [
                 'label' => $headline,
diff --git a/extensions/apidoc/templates/bootstrap/layouts/main.php b/extensions/apidoc/templates/bootstrap/layouts/main.php
index 9e1f19f..d71e156 100644
--- a/extensions/apidoc/templates/bootstrap/layouts/main.php
+++ b/extensions/apidoc/templates/bootstrap/layouts/main.php
@@ -64,7 +64,7 @@ $this->beginPage();
     }
 
     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([
--
libgit2 0.27.1