ObjectController: simpler title logic

This commit is contained in:
Thomas Gelf 2016-02-17 22:27:44 +01:00
parent 215f42926f
commit 2d29421521

View File

@ -100,14 +100,7 @@ abstract class ObjectController extends ActionController
); );
$form->setSuccessUrl($url); $form->setSuccessUrl($url);
if ($object->isTemplate()) { $this->view->title = sprintf($this->translate('Modify %s'), ucfirst($ltype));
$title = $this->translate('Modify Icinga %s template');
$form->setObjectType('template'); // WHY??
} else {
$title = $this->translate('Modify Icinga %s');
}
$this->view->title = sprintf($title, ucfirst($ltype));
$this->view->form->handleRequest(); $this->view->form->handleRequest();
$this->view->actionLinks = $this->view->icon('paste') . ' ' $this->view->actionLinks = $this->view->icon('paste') . ' '
@ -131,14 +124,11 @@ abstract class ObjectController extends ActionController
->setDb($this->db()) ->setDb($this->db())
->setSuccessUrl($url); ->setSuccessUrl($url);
if ($this->params->get('type') === 'template') { $this->view->title = sprintf(
$form->setObjectType('template'); $this->translate('Add new Icinga %s'),
$title = $this->translate('Add new Icinga %s template'); ucfirst($ltype)
} else { );
$title = $this->translate('Add new Icinga %s');
}
$this->view->title = sprintf($title, ucfirst($ltype));
$form->handleRequest(); $form->handleRequest();
$this->render('object/form', null, true); $this->render('object/form', null, true);
} }