diff --git a/library/Icinga/Web/Widget/Tab.php b/library/Icinga/Web/Widget/Tab.php index 94e2bc678..a54f29db6 100644 --- a/library/Icinga/Web/Widget/Tab.php +++ b/library/Icinga/Web/Widget/Tab.php @@ -123,6 +123,11 @@ class Tab extends AbstractWidget $this->label = $label; } + public function getLabel() + { + return $this->label; + } + /** * @param mixed $title */ diff --git a/library/Icinga/Web/Widget/Tabs.php b/library/Icinga/Web/Widget/Tabs.php index 64b898e50..afe5673b9 100644 --- a/library/Icinga/Web/Widget/Tabs.php +++ b/library/Icinga/Web/Widget/Tabs.php @@ -68,7 +68,9 @@ EOT; */ private $refreshTpl = <<< 'EOT'
  • - + + +
  • 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; }