ObjectsTabs: fix tabs for Choices
This commit is contained in:
parent
15386ec868
commit
70618169f1
|
@ -31,7 +31,7 @@ class TemplatechoicesController extends ActionController
|
|||
|
||||
protected function prepare($type, $title)
|
||||
{
|
||||
$this->tabs(new ObjectsTabs($type, $this->Auth()))->activate('choices');
|
||||
$this->tabs(new ObjectsTabs($type, $this->Auth(), $type))->activate('choices');
|
||||
$this->setAutorefreshInterval(10)->addTitle($title);
|
||||
$this->actions(new ChoicesActionBar($type, $this->url()));
|
||||
ChoicesTable::create($type, $this->db())->renderTo($this);
|
||||
|
|
|
@ -17,8 +17,9 @@ class ObjectsTabs extends Tabs
|
|||
if ($object->isGroup()) {
|
||||
$object = IcingaObject::createByType(substr($typeUrl, 0, -5));
|
||||
}
|
||||
$shortName = $object->getShortTableName();
|
||||
|
||||
$plType = strtolower(preg_replace('/cys$/', 'cies', $typeUrl . 's'));
|
||||
$plType = strtolower(preg_replace('/cys$/', 'cies', $shortName . 's'));
|
||||
if ($auth->hasPermission("director/${plType}")) {
|
||||
$this->add('index', array(
|
||||
'url' => sprintf('director/%s', $plType),
|
||||
|
@ -65,7 +66,7 @@ class ObjectsTabs extends Tabs
|
|||
if ($auth->hasPermission('director/admin')) {
|
||||
if ($object->supportsChoices()) {
|
||||
$this->add('choices', array(
|
||||
'url' => sprintf('director/templatechoices/%s', $typeUrl),
|
||||
'url' => sprintf('director/templatechoices/%s', $shortName),
|
||||
'label' => $this->translate('Choices')
|
||||
));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue