NavigationController: Rerender the layout when unsharing menu entries

refs #5600
This commit is contained in:
Johannes Meyer 2015-09-25 10:51:16 +02:00
parent e8f93e8ea1
commit 2952eaefcd
2 changed files with 10 additions and 4 deletions

View File

@ -293,9 +293,15 @@ class NavigationController extends Controller
$form = new Form(array(
'onSuccess' => function ($form) use ($navigationConfigForm) {
$itemName = $form->getValue('name');
try {
$navigationConfigForm->unshare($form->getValue('name'));
$newConfig = $navigationConfigForm->unshare($itemName);
if ($navigationConfigForm->save()) {
if ($newConfig->getSection($itemName)->type === 'menu-item') {
$form->getResponse()->setRerenderLayout();
}
Notification::success(sprintf(
t('Navigation item "%s" has been unshared'),
$form->getValue('name')

View File

@ -350,7 +350,7 @@ class NavigationConfigForm extends ConfigForm
: ((! isset($data['users']) || !$data['users']) && (! isset($data['groups']) || !$data['groups']))
) {
// 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'])) {
if ($this->getUser()->can('application/share/navigation')) {
@ -484,7 +484,7 @@ class NavigationConfigForm extends ConfigForm
* @param string $name
* @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 IcingaException In case the navigation item has a parent assigned to it
@ -536,7 +536,7 @@ class NavigationConfigForm extends ConfigForm
$config->setSection($name, $itemConfig);
$this->setIniConfig($config);
return $this;
return $config;
}
/**