mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-23 22:04:25 +02:00
NavigationController: Rerender the layout when unsharing menu entries
refs #5600
This commit is contained in:
parent
e8f93e8ea1
commit
2952eaefcd
@ -293,9 +293,15 @@ class NavigationController extends Controller
|
|||||||
|
|
||||||
$form = new Form(array(
|
$form = new Form(array(
|
||||||
'onSuccess' => function ($form) use ($navigationConfigForm) {
|
'onSuccess' => function ($form) use ($navigationConfigForm) {
|
||||||
|
$itemName = $form->getValue('name');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$navigationConfigForm->unshare($form->getValue('name'));
|
$newConfig = $navigationConfigForm->unshare($itemName);
|
||||||
if ($navigationConfigForm->save()) {
|
if ($navigationConfigForm->save()) {
|
||||||
|
if ($newConfig->getSection($itemName)->type === 'menu-item') {
|
||||||
|
$form->getResponse()->setRerenderLayout();
|
||||||
|
}
|
||||||
|
|
||||||
Notification::success(sprintf(
|
Notification::success(sprintf(
|
||||||
t('Navigation item "%s" has been unshared'),
|
t('Navigation item "%s" has been unshared'),
|
||||||
$form->getValue('name')
|
$form->getValue('name')
|
||||||
|
@ -350,7 +350,7 @@ class NavigationConfigForm extends ConfigForm
|
|||||||
: ((! isset($data['users']) || !$data['users']) && (! isset($data['groups']) || !$data['groups']))
|
: ((! isset($data['users']) || !$data['users']) && (! isset($data['groups']) || !$data['groups']))
|
||||||
) {
|
) {
|
||||||
// It is shared but shouldn't anymore
|
// It is shared but shouldn't anymore
|
||||||
$config = $this->unshare($name, isset($data['parent']) ? $data['parent'] : null)->config;
|
$config = $this->unshare($name, isset($data['parent']) ? $data['parent'] : null);
|
||||||
}
|
}
|
||||||
} elseif ((isset($data['users']) && $data['users']) || (isset($data['groups']) && $data['groups'])) {
|
} elseif ((isset($data['users']) && $data['users']) || (isset($data['groups']) && $data['groups'])) {
|
||||||
if ($this->getUser()->can('application/share/navigation')) {
|
if ($this->getUser()->can('application/share/navigation')) {
|
||||||
@ -484,7 +484,7 @@ class NavigationConfigForm extends ConfigForm
|
|||||||
* @param string $name
|
* @param string $name
|
||||||
* @param string $parent
|
* @param string $parent
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return Config The new config of the given navigation item
|
||||||
*
|
*
|
||||||
* @throws NotFoundError In case no navigation item with the given name is found
|
* @throws NotFoundError In case no navigation item with the given name is found
|
||||||
* @throws IcingaException In case the navigation item has a parent assigned to it
|
* @throws IcingaException In case the navigation item has a parent assigned to it
|
||||||
@ -536,7 +536,7 @@ class NavigationConfigForm extends ConfigForm
|
|||||||
|
|
||||||
$config->setSection($name, $itemConfig);
|
$config->setSection($name, $itemConfig);
|
||||||
$this->setIniConfig($config);
|
$this->setIniConfig($config);
|
||||||
return $this;
|
return $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user