Fix issue that caused the refresh button to remove side bar

Do not apply base target globally for all toolbar elements, but specifically for those that should remove side-bars.

refs #8623
refs #6436
This commit is contained in:
Matthias Jentsch 2015-07-29 17:18:52 +02:00
parent 6db79a72d5
commit 3e7cc299ec
6 changed files with 29 additions and 8 deletions

View File

@ -32,12 +32,14 @@ class ConfigController extends Controller
$tabs->add('general', array( $tabs->add('general', array(
'title' => $this->translate('Adjust the general configuration of Icinga Web 2'), 'title' => $this->translate('Adjust the general configuration of Icinga Web 2'),
'label' => $this->translate('General'), 'label' => $this->translate('General'),
'url' => 'config/general' 'url' => 'config/general',
'baseTarget' => '_main'
)); ));
$tabs->add('resource', array( $tabs->add('resource', array(
'title' => $this->translate('Configure which resources are being utilized by Icinga Web 2'), 'title' => $this->translate('Configure which resources are being utilized by Icinga Web 2'),
'label' => $this->translate('Resources'), 'label' => $this->translate('Resources'),
'url' => 'config/resource' 'url' => 'config/resource',
'baseTarget' => '_main'
)); ));
return $tabs; return $tabs;
} }
@ -51,12 +53,14 @@ class ConfigController extends Controller
$tabs->add('userbackend', array( $tabs->add('userbackend', array(
'title' => $this->translate('Configure how users authenticate with and log into Icinga Web 2'), 'title' => $this->translate('Configure how users authenticate with and log into Icinga Web 2'),
'label' => $this->translate('User Backends'), 'label' => $this->translate('User Backends'),
'url' => 'config/userbackend' 'url' => 'config/userbackend',
'baseTarget' => '_main'
)); ));
$tabs->add('usergroupbackend', array( $tabs->add('usergroupbackend', array(
'title' => $this->translate('Configure how users are associated with groups by Icinga Web 2'), 'title' => $this->translate('Configure how users are associated with groups by Icinga Web 2'),
'label' => $this->translate('User Group Backends'), 'label' => $this->translate('User Group Backends'),
'url' => 'usergroupbackend/list' 'url' => 'usergroupbackend/list',
'baseTarget' => '_main'
)); ));
return $tabs; return $tabs;
} }

View File

@ -166,7 +166,8 @@ class RoleController extends AuthBackendController
'Configure roles to permit or restrict users and groups accessing Icinga Web 2' 'Configure roles to permit or restrict users and groups accessing Icinga Web 2'
), ),
'label' => $this->translate('Roles'), 'label' => $this->translate('Roles'),
'url' => 'role/list' 'url' => 'role/list',
'baseTarget' => '_main'
) )
); );

View File

@ -1,4 +1,4 @@
<div class="controls" data-base-target="_main"> <div class="controls">
<?= $tabs; ?> <?= $tabs; ?>
</div> </div>
<div class="content" data-base-target="_next"> <div class="content" data-base-target="_next">

View File

@ -1,4 +1,4 @@
<div class="controls" data-base-target="_main"> <div class="controls">
<?= $tabs; ?> <?= $tabs; ?>
</div> </div>
<div class="content" data-base-target="_next"> <div class="content" data-base-target="_next">

View File

@ -1,4 +1,4 @@
<div class="controls" data-base-target="_main"> <div class="controls">
<?= $tabs ?> <?= $tabs ?>
</div> </div>
<div class="content"> <div class="content">

View File

@ -91,6 +91,13 @@ class Tab extends AbstractWidget
*/ */
private $targetBlank = false; private $targetBlank = false;
/**
* Data base target that determines if the link will be opened in a side-bar or in the main container
*
* @var null
*/
private $baseTarget = null;
/** /**
* Sets an icon image for this tab * Sets an icon image for this tab
* *
@ -210,6 +217,11 @@ class Tab extends AbstractWidget
$this->targetBlank = $value; $this->targetBlank = $value;
} }
public function setBaseTarget($value)
{
$this->baseTarget = $value;
}
/** /**
* Create a new Tab with the given properties * Create a new Tab with the given properties
* *
@ -274,6 +286,10 @@ class Tab extends AbstractWidget
} }
} }
if ($this->baseTarget !== null) {
$tagParams['data-base-target'] = $this->baseTarget;
}
if ($this->icon !== null) { if ($this->icon !== null) {
if (strpos($this->icon, '.') === false) { if (strpos($this->icon, '.') === false) {
$caption = $view->icon($this->icon) . $caption; $caption = $view->icon($this->icon) . $caption;