Improved guide and api doc header and titles

fixes #7069
fixes #7031
This commit is contained in:
octicon-git-branch(16/)
octicon-tag(16/)
Carsten Brandt
2015-01-28 22:03:52 +01:00
gitea-unlock(16/)
parent 4e39381d49
commit fca8143440
octicon-diff(16/tw-mr-1) 5 changed files with 22 additions and 7 deletions

2
extensions/apidoc/templates/bootstrap/layouts/api.php
View File

@@ -11,7 +11,7 @@ use yii\helpers\StringHelper;
/** @var $renderer ApiRenderer */
$renderer = $this->context;
$this->beginContent('@yii/apidoc/templates/bootstrap/layouts/main.php'); ?>
$this->beginContent('@yii/apidoc/templates/bootstrap/layouts/main.php', isset($type) ? ['type' => $type] : []); ?>
<div class="row">
<div class="col-md-3">

12
extensions/apidoc/templates/bootstrap/layouts/guide.php
View File

@@ -6,7 +6,17 @@ use yii\apidoc\templates\bootstrap\SideNavWidget;
/* @var $content string */
/* @var $chapters array */
$this->beginContent('@yii/apidoc/templates/bootstrap/layouts/main.php'); ?>
if (isset($currentFile)) {
foreach ($chapters as $chapter) {
foreach ($chapter['content'] as $chContent) {
if ($chContent['file'] == basename($currentFile)) {
$guideHeadline = "{$chContent['headline']} - {$chapter['headline']}";
}
}
}
}
$this->beginContent('@yii/apidoc/templates/bootstrap/layouts/main.php', isset($guideHeadline) ? ['guideHeadline' => $guideHeadline] : []); ?>
<div class="row">
<div class="col-md-2">

10
extensions/apidoc/templates/bootstrap/layouts/main.php
View File

@@ -3,6 +3,7 @@
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\helpers\Html;
use yii\helpers\StringHelper;
/* @var $this yii\web\View */
@@ -29,7 +30,14 @@ $this->beginPage();
<meta name="language" content="en" />
<?= Html::csrfMetaTags() ?>
<?php $this->head() ?>
<title><?= Html::encode($this->context->pageTitle) ?></title>
<title><?php if (isset($type)) {
echo Html::encode(StringHelper::basename($type->name) . ", {$type->name} - {$this->context->pageTitle}");
} elseif (isset($guideHeadline)) {
echo Html::encode("$guideHeadline - {$this->context->pageTitle}");
} else {
echo Html::encode($this->context->pageTitle);
}
?></title>
</head>
<body>