[icinga-checkins] icinga.org: icingaweb2-module-director/master: ObjectController: simpler title logic

git at icinga.org git at icinga.org
Thu Feb 18 00:52:39 CET 2016


Module: icingaweb2-module-director
Branch: master
Commit: 2d2942152169510ba515b7be8b75c39ad579deac
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=2d2942152169510ba515b7be8b75c39ad579deac

Author: Thomas Gelf <thomas at gelf.net>
Date:   Wed Feb 17 22:27:44 2016 +0100

ObjectController: simpler title logic

---

 .../Director/Web/Controller/ObjectController.php   |   20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/library/Director/Web/Controller/ObjectController.php b/library/Director/Web/Controller/ObjectController.php
index 9752106..2a1863f 100644
--- a/library/Director/Web/Controller/ObjectController.php
+++ b/library/Director/Web/Controller/ObjectController.php
@@ -100,14 +100,7 @@ abstract class ObjectController extends ActionController
         );
         $form->setSuccessUrl($url);
 
-        if ($object->isTemplate()) {
-            $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->title = sprintf($this->translate('Modify %s'), ucfirst($ltype));
         $this->view->form->handleRequest();
 
         $this->view->actionLinks = $this->view->icon('paste') . ' '
@@ -131,14 +124,11 @@ abstract class ObjectController extends ActionController
             ->setDb($this->db())
             ->setSuccessUrl($url);
 
-        if ($this->params->get('type') === 'template') {
-            $form->setObjectType('template');
-            $title = $this->translate('Add new Icinga %s template');
-        } else {
-            $title = $this->translate('Add new Icinga %s');
-        }
+        $this->view->title = sprintf(
+            $this->translate('Add new Icinga %s'),
+            ucfirst($ltype)
+        );
 
-        $this->view->title = sprintf($title, ucfirst($ltype));
         $form->handleRequest();
         $this->render('object/form', null, true);
     }



More information about the icinga-checkins mailing list