From e5819ef1b2cc4428461308bd342d3d7c95895440 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 22 May 2015 16:13:38 +0200 Subject: [PATCH] GroupController: Display a tab when showing a group refs #8826 --- application/controllers/GroupController.php | 44 ++++++++++++++------- application/views/scripts/group/show.phtml | 2 +- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/application/controllers/GroupController.php b/application/controllers/GroupController.php index e4a9f6bb7..ddb4d1e84 100644 --- a/application/controllers/GroupController.php +++ b/application/controllers/GroupController.php @@ -18,15 +18,6 @@ use Icinga\Web\Widget; class GroupController extends Controller { - /** - * Initialize this controller - */ - public function init() - { - parent::init(); - $this->createTabs(); - } - /** * Redirect to this controller's list action */ @@ -84,7 +75,7 @@ class GroupController extends Controller } $this->view->backend = $backend; - $this->getTabs()->activate('group/list'); + $this->createListTabs()->activate('group/list'); $this->setupLimitControl(); $this->setupSortControl( @@ -143,6 +134,7 @@ class GroupController extends Controller $this->view->group = $group; $this->view->backend = $backend; $this->view->members = $members; + $this->createShowTabs($backend->getName(), $groupName)->activate('group/show'); if ($backend instanceof Reducible) { $removeForm = new Form(); @@ -342,9 +334,9 @@ class GroupController extends Controller } /** - * Create the tabs + * Create the tabs to list users and groups */ - protected function createTabs() + protected function createListTabs() { $tabs = $this->getTabs(); $tabs->add( @@ -352,7 +344,7 @@ class GroupController extends Controller array( 'title' => $this->translate('List users of authentication backends'), 'label' => $this->translate('Users'), - 'icon' => 'users', + 'icon' => 'user', 'url' => 'user/list' ) ); @@ -361,9 +353,33 @@ class GroupController extends Controller array( 'title' => $this->translate('List groups of user group backends'), 'label' => $this->translate('Groups'), - 'icon' => 'cubes', + 'icon' => 'users', 'url' => 'group/list' ) ); + + return $tabs; + } + + /** + * Create the tabs to display when showing a group + * + * @param string $backendName + * @param string $groupName + */ + protected function createShowTabs($backendName, $groupName) + { + $tabs = $this->getTabs(); + $tabs->add( + 'group/show', + array( + 'title' => sprintf($this->translate('Show group %s'), $groupName), + 'label' => $this->translate('Group'), + 'icon' => 'users', + 'url' => Url::fromPath('group/show', array('backend' => $backendName, 'group' => $groupName)) + ) + ); + + return $tabs; } } diff --git a/application/views/scripts/group/show.phtml b/application/views/scripts/group/show.phtml index 647f31eab..718dde255 100644 --- a/application/views/scripts/group/show.phtml +++ b/application/views/scripts/group/show.phtml @@ -25,7 +25,7 @@ if ($backend instanceof Updatable) { ?>
compact): ?> - showOnlyCloseButton(); ?> +

escape($group->group_name); ?>