doc: set page title

refs #4820
This commit is contained in:
Eric Lippmann 2014-08-19 13:38:18 +02:00
parent d35e0816c9
commit 55b3a5384a
4 changed files with 22 additions and 8 deletions

View File

@ -1,5 +1,5 @@
<div class="controls"> <div class="controls">
<h1><?= $this->translate(sprintf('%s Documentation', ucfirst($docName))); ?></h1> <h1><?= $title ?></h1>
</div> </div>
<div class="content toc"> <div class="content toc">
<?= $tocRenderer->render($this, $this->getHelper('Url')); ?> <?= $tocRenderer->render($this, $this->getHelper('Url')); ?>

View File

@ -27,6 +27,7 @@ class DocController extends ModuleActionController
$url, $url,
$urlParams $urlParams
); );
$this->view->title = $chapterId;
$this->_helper->viewRenderer('chapter', null, true); $this->_helper->viewRenderer('chapter', null, true);
} }
@ -42,7 +43,9 @@ class DocController extends ModuleActionController
{ {
$parser = new DocParser($path); $parser = new DocParser($path);
$this->view->tocRenderer = new TocRenderer($parser->getDocTree(), $url, $urlParams); $this->view->tocRenderer = new TocRenderer($parser->getDocTree(), $url, $urlParams);
$name = ucfirst($name);
$this->view->docName = $name; $this->view->docName = $name;
$this->view->title = $this->translate(sprintf('%s Documentation', $name));
$this->_helper->viewRenderer('toc', null, true); $this->_helper->viewRenderer('toc', null, true);
} }

View File

@ -222,7 +222,7 @@ class SectionRenderer extends Renderer
if ($renderNavigation) { if ($renderNavigation) {
foreach ($this->docTree as $chapter) { foreach ($this->docTree as $chapter) {
if ($chapter->getValue()->getId() === $section->getChapterId()) { if ($chapter->getValue()->getId() === $section->getChapterId()) {
$content[] = '<ul class="navigation">'; $navigation = array('<ul class="navigation">');
$this->docTree->prev(); $this->docTree->prev();
$prev = $this->docTree->current(); $prev = $this->docTree->current();
if ($prev !== null) { if ($prev !== null) {
@ -240,8 +240,8 @@ class SectionRenderer extends Renderer
); );
$url = $view->url($path); $url = $view->url($path);
$url->setAnchor($this->encodeAnchor($prev->getId())); $url->setAnchor($this->encodeAnchor($prev->getId()));
$content[] = sprintf( $navigation[] = sprintf(
'<li><a %shref="%s">%s</a></li>', '<li class="prev"><a %shref="%s">%s</a></li>',
$prev->isNoFollow() ? 'rel="nofollow" ' : '', $prev->isNoFollow() ? 'rel="nofollow" ' : '',
$url->getAbsoluteUrl(), $url->getAbsoluteUrl(),
$view->escape($prev->getTitle()) $view->escape($prev->getTitle())
@ -253,7 +253,7 @@ class SectionRenderer extends Renderer
$this->docTree->next(); $this->docTree->next();
} }
$url = $view->url($this->tocUrl); $url = $view->url($this->tocUrl);
$content[] = sprintf( $navigation[] = sprintf(
'<li><a href="%s">%s</a></li>', '<li><a href="%s">%s</a></li>',
$url->getAbsoluteUrl(), $url->getAbsoluteUrl(),
mt('doc', 'Index') mt('doc', 'Index')
@ -274,14 +274,15 @@ class SectionRenderer extends Renderer
); );
$url = $view->url($path); $url = $view->url($path);
$url->setAnchor($this->encodeAnchor($next->getId())); $url->setAnchor($this->encodeAnchor($next->getId()));
$content[] = sprintf( $navigation[] = sprintf(
'<li><a %shref="%s">%s</a></li>', '<li class="next"><a %shref="%s">%s</a></li>',
$next->isNoFollow() ? 'rel="nofollow" ' : '', $next->isNoFollow() ? 'rel="nofollow" ' : '',
$url->getAbsoluteUrl(), $url->getAbsoluteUrl(),
$view->escape($next->getTitle()) $view->escape($next->getTitle())
); );
} }
$content[] = '</ul>'; $navigation[] = '</ul>';
$content = array_merge($navigation, $content, $navigation);
break; break;
} }
} }

View File

@ -48,5 +48,15 @@ div.chapter > ul.navigation {
color: #fff; color: #fff;
text-decoration: none; text-decoration: none;
} }
&.prev {
padding-right: 0.6em;
border-right: 2px solid #fff;
}
&.next {
padding-left: 0.6em;
border-left: 2px solid #fff;
}
} }
} }