Add accessibility to renderRefreshTab

refs #7968
This commit is contained in:
Alexander Fuhr 2015-02-25 12:14:26 +01:00
parent c583a351bb
commit 481c58ec03
2 changed files with 34 additions and 2 deletions

View File

@ -123,6 +123,11 @@ class Tab extends AbstractWidget
$this->label = $label;
}
public function getLabel()
{
return $this->label;
}
/**
* @param mixed $title
*/

View File

@ -68,7 +68,9 @@ EOT;
*/
private $refreshTpl = <<< 'EOT'
<li>
<a class="refresh" href="{URL}"><i aria-hidden="true" class="icon-cw" data-load-class="icon-spin6 animate-spin"></i></a>
<a class="spinner" href="{URL}" title="{TITLE}" aria-label="{LABEL}">
<i aria-hidden="true" class="icon-cw"></i>
</a>
</li>
EOT;
@ -330,7 +332,32 @@ EOT;
private function renderRefreshTab()
{
$url = Url::fromRequest()->without('renderLayout');
$tpl = str_replace('{URL}', $url, $this->refreshTpl);
$tab = $this->get($this->getActiveName());
if ($tab !== null) {
$caption = Icinga::app()->getViewRenderer()->view->escape(
$tab->getLabel()
);
} else {
$caption = t('Content');
}
$label = t(sprintf('Refresh the %s', $caption));
$title = $label;
$tpl = str_replace(
array(
'{URL}',
'{TITLE}',
'{LABEL}'
),
array(
$url,
$title,
$label
),
$this->refreshTpl
);
return $tpl;
}