Add tab for new, update and remove navigation item

refs #5543
This commit is contained in:
Eric Lippmann 2015-10-01 00:40:54 +02:00
parent f3f7fa381b
commit 8cff607b5d
2 changed files with 3 additions and 15 deletions

View File

@ -202,7 +202,6 @@ class NavigationController extends Controller
$form->setRedirectUrl('navigation');
$form->setUser($this->Auth()->getUser());
$form->setItemTypes($this->listItemTypes());
$form->setTitle($this->translate('Create New Navigation Item'));
$form->addDescription($this->translate('Create a new navigation item, such as a menu entry or dashlet.'));
// TODO: Fetch all "safe" parameters from the url and populate them
@ -231,8 +230,7 @@ class NavigationController extends Controller
});
$form->handleRequest();
$this->view->form = $form;
$this->render('form');
$this->renderForm($form, $this->translate('New Navigation Item'));
}
/**
@ -256,7 +254,6 @@ class NavigationController extends Controller
$form->setShareConfig(Config::navigation($itemType));
$form->setUserConfig(Config::navigation($itemType, $itemOwner));
$form->setRedirectUrl($referrer === 'shared' ? 'navigation/shared' : 'navigation');
$form->setTitle(sprintf($this->translate('Edit %s %s'), $this->getItemLabel($itemType), $itemName));
$form->setOnSuccess(function (NavigationConfigForm $form) use ($itemName) {
$data = array_map(
function ($v) {
@ -293,8 +290,7 @@ class NavigationController extends Controller
$this->httpNotFound(sprintf($this->translate('Navigation item "%s" not found'), $itemName));
}
$this->view->form = $form;
$this->render('form');
$this->renderForm($form, $this->translate('Update Navigation Item'));
}
/**
@ -313,7 +309,6 @@ class NavigationController extends Controller
$form = new ConfirmRemovalForm();
$form->setRedirectUrl('navigation');
$form->setTitle(sprintf($this->translate('Remove %s %s'), $this->getItemLabel($itemType), $itemName));
$form->setOnSuccess(function (ConfirmRemovalForm $form) use ($itemName, $navigationConfigForm) {
try {
$itemConfig = $navigationConfigForm->delete($itemName);
@ -338,8 +333,7 @@ class NavigationController extends Controller
});
$form->handleRequest();
$this->view->form = $form;
$this->render('form');
$this->renderForm($form, $this->translate('Remove Navigation Item'));
}
/**

View File

@ -1,6 +0,0 @@
<div class="controls">
<?= $tabs->showOnlyCloseButton(); ?>
</div>
<div class="content">
<?= $form; ?>
</div>