Add proper titles to the documentation tocs and search results

refs #8458
This commit is contained in:
Johannes Meyer 2015-02-23 17:12:34 +01:00
parent 676f10bb87
commit a1e7cd8906
2 changed files with 41 additions and 8 deletions

View File

@ -107,11 +107,30 @@ class DocSearchRenderer extends DocRenderer
);
/** @type \Icinga\Web\Url $url */
$url->setAnchor($this->encodeAnchor($section->getId()));
$this->content[] = sprintf(
'<li><a data-base-target="_next" %shref="%s">%s</a>',
$section->getNoFollow() ? 'rel="nofollow" ' : '',
$urlAttributes = array(
'data-base-target' => '_next',
'title' => sprintf(
$this->getView()->translate(
'Show all matches of "%s" in %sthe chapter "%s"',
'search.render.section.link'
),
$this->getInnerIterator()->getSearch()->getInput(),
$section->getId() !== $section->getChapter()->getId() ? sprintf(
$this->getView()->translate('the section "%s" of ', 'search.render.section.link'),
$section->getTitle()
) : '',
$section->getChapter()->getTitle()
)
);
if ($section->getNoFollow()) {
$urlAttributes['rel'] = 'nofollow';
}
$this->content[] = '<li>' . $this->getView()->qlink(
$title,
$url->getAbsoluteUrl(),
$title
null,
$urlAttributes,
false
);
if (! empty($contentMatches)) {
$this->content = array_merge($this->content, $contentMatches);

View File

@ -87,11 +87,25 @@ class DocTocRenderer extends DocRenderer
$url = $view->url($path);
/** @type \Icinga\Web\Url $url */
$url->setAnchor($this->encodeAnchor($section->getId()));
$this->content[] = sprintf(
'<li><a data-base-target="_next" %shref="%s">%s</a>',
$section->getNoFollow() ? 'rel="nofollow" ' : '',
$urlAttributes = array(
'data-base-target' => '_next',
'title' => sprintf(
$this->getView()->translate('Show the %schapter "%s"', 'toc.render.section.link'),
$section->getId() !== $section->getChapter()->getId() ? sprintf(
$this->getView()->translate('section "%s" of the ', 'toc.render.section.link'),
$section->getTitle()
) : '',
$section->getChapter()->getTitle()
)
);
if ($section->getNoFollow()) {
$urlAttributes['rel'] = 'nofollow';
}
$this->content[] = '<li>' . $this->getView()->qlink(
$section->getTitle(),
$url->getAbsoluteUrl(),
$view->escape($section->getTitle())
null,
$urlAttributes
);
if (! $section->hasChildren()) {
$this->content[] = '</li>';