[icinga-checkins] icinga.org: icingaweb2-module-director/master: Datafield: provide better explainations

git at icinga.org git at icinga.org
Tue Oct 18 04:06:29 CEST 2016


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

Author: Thomas Gelf <thomas at gelf.net>
Date:   Mon Oct 17 17:48:04 2016 +0000

Datafield: provide better explainations

---

 application/controllers/DataController.php      |    6 +++---
 application/controllers/DatafieldController.php |   23 ++++++++---------------
 application/forms/DirectorDatafieldForm.php     |   22 ++++++++++++++++++----
 3 files changed, 29 insertions(+), 22 deletions(-)

diff --git a/application/controllers/DataController.php b/application/controllers/DataController.php
index 8886305..ad2f0bc 100644
--- a/application/controllers/DataController.php
+++ b/application/controllers/DataController.php
@@ -10,7 +10,7 @@ class DataController extends ActionController
     public function listsAction()
     {
         $this->view->addLink = $this->view->qlink(
-            $this->translate('Add list'),
+            $this->translate('Add'),
             'director/data/list',
             null,
             array('class' => 'icon-plus')
@@ -62,7 +62,7 @@ class DataController extends ActionController
             ))->activate('editlist');
 
         } else {
-            $this->view->title = $this->translate('Add data list');
+            $this->view->title = $this->translate('Add');
 
             $this->getTabs()->add('addlist', array(
                 'url'       => 'director/data/list',
@@ -116,7 +116,7 @@ class DataController extends ActionController
     public function fieldsAction()
     {
         $this->view->addLink = $this->view->qlink(
-            $this->translate('Add field'),
+            $this->translate('Add'),
             'director/datafield/add',
             null,
             array('class' => 'icon-plus')
diff --git a/application/controllers/DatafieldController.php b/application/controllers/DatafieldController.php
index 20fdaaa..d0c8c69 100644
--- a/application/controllers/DatafieldController.php
+++ b/application/controllers/DatafieldController.php
@@ -24,30 +24,23 @@ class DatafieldController extends ActionController
             $edit = true;
         }
 
-        if ($edit) {
-            $this->view->title = $this->translate('Edit field');
-            $this->getTabs()->add('editfield', array(
-                'url'       => 'director/datafield/edit' . '?id=' . $id,
-                'label'     => $this->view->title,
-            ))->activate('editfield');
-        } else {
-            $this->view->title = $this->translate('Add field');
-            $this->getTabs()->add('addfield', array(
-                'url'       => 'director/datafield/add',
-                'label'     => $this->view->title,
-            ))->activate('addfield');
-        }
-
         $form = $this->view->form = $this->loadForm('directorDatafield')
             ->setSuccessUrl('director/data/fields')
             ->setDb($this->db());
 
         if ($edit) {
             $form->loadObject($id);
+            $this->view->title = sprintf(
+                $this->translate('Modify %s'),
+                $form->getObject()->varname
+            );
+            $this->singleTab($this->translate('Edit a field'));
+        } else {
+            $this->view->title = $this->translate('Add a new Data Field');
+            $this->singleTab($this->translate('New field'));
         }
 
         $form->handleRequest();
-
         $this->render('object/form', null, true);
     }
 }
diff --git a/application/forms/DirectorDatafieldForm.php b/application/forms/DirectorDatafieldForm.php
index 6ffdd82..d3934e9 100644
--- a/application/forms/DirectorDatafieldForm.php
+++ b/application/forms/DirectorDatafieldForm.php
@@ -74,24 +74,38 @@ class DirectorDatafieldForm extends DirectorObjectForm
     public function setup()
     {
         $this->addHtmlHint(
-            $this->translate('Data fields allow you to customize input controls your custom variables.')
+            $this->translate(
+                'Data fields allow you to customize input controls for Icinga custom'
+                . ' variables. Once you defined them here, you can provide them through'
+                . ' your defined templates. This gives you a granular control over what'
+                . ' properties your users should be allowed to configure in which way.'
+            )
         );
 
         $this->addElement('text', 'varname', array(
             'label'       => $this->translate('Field name'),
-            'description' => $this->translate('The unique name of the field'),
+            'description' => $this->translate(
+                'The unique name of the field. This will be the name of the custom'
+                . ' variable in the rendered Icinga configuration.'
+            ),
             'required'    => true,
         ));
 
         $this->addElement('text', 'caption', array(
             'label'       => $this->translate('Caption'),
             'required'    => true,
-            'description' => $this->translate('The caption which should be displayed')
+            'description' => $this->translate(
+                'The caption which should be displayed to your users when this field'
+                . ' is shown'
+            )
         ));
 
         $this->addElement('textarea', 'description', array(
             'label'       => $this->translate('Description'),
-            'description' => $this->translate('A description about the field'),
+            'description' => $this->translate(
+                'An extended description for this field. Will be shown as soon as a'
+                . ' user puts the focus on this field'
+            ),
             'rows'        => '3',
         ));
 



More information about the icinga-checkins mailing list