From bb664a87ea27381b77ac9915d5e5f31598b99dc1 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 20 Nov 2014 13:23:21 +0100 Subject: [PATCH] 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 163dba455..37d8789fe 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;