[icinga-checkins] icinga.org: icingaweb2/feature/security-gui-5647: Fix ugly positioning of help icons

git at icinga.org git at icinga.org
Thu Nov 20 16:13:03 CET 2014


Module: icingaweb2
Branch: feature/security-gui-5647
Commit: bb664a87ea27381b77ac9915d5e5f31598b99dc1
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=bb664a87ea27381b77ac9915d5e5f31598b99dc1

Author: Eric Lippmann <eric.lippmann at netways.de>
Date:   Thu Nov 20 13:23:21 2014 +0100

Fix ugly positioning of help icons

If an element has a description, the description is now added to the element's label as title.
The CSS class has-feedback ensurers that the help icon is rendererd. If everything is working fine,
I'll the remove the super duper Help decorator.

---

 library/Icinga/Web/Form.php |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/library/Icinga/Web/Form.php b/library/Icinga/Web/Form.php
index 163dba4..37d8789 100644
--- a/library/Icinga/Web/Form.php
+++ b/library/Icinga/Web/Form.php
@@ -116,7 +116,6 @@ class Form extends Zend_Form
     public static $defaultElementDecorators = array(
         array('ViewHelper', array('separator' => '')),
         array('Errors', array('separator' => '')),
-        array('Help'),
         array('Label', array('separator' => '')),
         array('HtmlTag', array('tag' => 'div', 'class' => 'element'))
     );
@@ -512,7 +511,14 @@ class Form extends Zend_Form
 
         $el = parent::createElement($type, $name, $options);
 
-        if ($el && $el->getAttrib('autosubmit')) {
+        if (($description = $el->getDescription()) !== null && ($label = $el->getDecorator('label')) !== null) {
+            $label->setOptions(array(
+                'title' => $description,
+                'class' => 'has-feedback'
+            ));
+        }
+
+        if ($el->getAttrib('autosubmit')) {
             $noScript = new NoScriptApply(); // Non-JS environments
             $decorators = $el->getDecorators();
             $pos = array_search('Zend_Form_Decorator_ViewHelper', array_keys($decorators)) + 1;



More information about the icinga-checkins mailing list