[icinga-checkins] icinga.org: icingaweb2-module-director/fiddle/mfrosch-2: WIP: ObjectController: Add title information for non-objects

git at icinga.org git at icinga.org
Fri Jul 22 12:03:50 CEST 2016


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

Author: Markus Frosch <lazyfrosch at icinga.org>
Date:   Tue Jul 19 17:05:56 2016 +0200

WIP: ObjectController: Add title information for non-objects

---

 library/Director/Web/Controller/ObjectController.php |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/library/Director/Web/Controller/ObjectController.php b/library/Director/Web/Controller/ObjectController.php
index 5639c32..3a81011 100644
--- a/library/Director/Web/Controller/ObjectController.php
+++ b/library/Director/Web/Controller/ObjectController.php
@@ -8,7 +8,6 @@ use Icinga\Exception\InvalidPropertyException;
 use Icinga\Exception\NotFoundError;
 use Icinga\Module\Director\IcingaConfig\IcingaConfig;
 use Icinga\Module\Director\Objects\IcingaObject;
-use Icinga\Web\Url;
 
 abstract class ObjectController extends ActionController
 {
@@ -28,6 +27,7 @@ abstract class ObjectController extends ActionController
         $type = $this->getType();
 
         if ($object = $this->loadObject()) {
+            /** @var IcingaObject $object */
             $this->beforeTabs();
             $params = $object->getUrlParams();
 
@@ -156,7 +156,21 @@ abstract class ObjectController extends ActionController
             ->setApi($this->getApiIfAvailable());
         $form->setObject($object);
 
-        $this->view->title = $object->object_name;
+        if ($object->object_type !== 'object') {
+            $this->view->title = sprintf(
+                '%s %s: %s',
+                $type,
+                ucfirst($object->object_type),
+                $object->object_name
+            );
+        }
+        else {
+            $this->view->title = sprintf(
+                '%s: %s',
+                $type,
+                $object->object_name
+            );
+        }
         $this->view->form->handleRequest();
 
         $this->view->actionLinks = $this->createCloneLink();



More information about the icinga-checkins mailing list