Adjusted buttons and a tags

refs #4869
This commit is contained in:
Marius Hein 2013-10-15 18:09:16 +02:00
parent 6f51f40fc0
commit 7a406b313f
4 changed files with 30 additions and 8 deletions

View File

@ -599,6 +599,14 @@ class Form extends Zend_Form
{
parent::addElement($element, $name, $options);
$el = $name ? $this->getElement($name) : $element;
// Do not add structural elements to invisible elements
// which produces ugly views
if (strpos(strtolower(get_class($el)), 'hidden') !== false) {
$el->setDecorators(array('ViewHelper'));
return $this;
}
if ($el) {
$el->removeDecorator('HtmlTag');
$el->removeDecorator('Label');

View File

@ -22,7 +22,6 @@ class Zend_View_Helper_CommandForm extends Zend_View_Helper_Abstract
private function simpleForm($commandName, array $arguments = array())
{
$form = new Form();
$form->setIgnoreChangeDiscarding(true);
$form->setAttrib('data-icinga-component', 'app/ajaxPostSubmitForm');
@ -33,6 +32,8 @@ class Zend_View_Helper_CommandForm extends Zend_View_Helper_Abstract
$hiddenField = new Zend_Form_Element_Hidden($elementName);
$hiddenField->setValue($elementValue);
$form->addElement($hiddenField);
$hiddenField = $form->getElement($elementName);
}
return $form;
@ -72,6 +73,7 @@ class Zend_View_Helper_CommandForm extends Zend_View_Helper_Abstract
public function labelSubmitForm($submitLabel, $submitTitle, $cls, $commandName, array $arguments = array())
{
$form = $this->simpleForm($commandName, $arguments);
$button = new Zend_Form_Element_Button(
array(
'name' => 'btn_submit',
@ -84,10 +86,11 @@ class Zend_View_Helper_CommandForm extends Zend_View_Helper_Abstract
)
);
$button->setDecorators(array('ViewHelper'));
$form->addElement($button);
// Because of implicit added decorators
$form->getElement('btn_submit')->setDecorators(array('ViewHelper'));
return $form;
}

View File

@ -1,5 +1,8 @@
<?php
$o = $this->object;
/** @var Zend_View_Helper_CommandForm $cf */
$cf = $this->getHelper('CommandForm');
?>
<div>
<div class="panel-heading">
@ -16,7 +19,9 @@
<tr>
<td>Passive Checks</td>
<td><div class="icon-table-hint icon-edit pull-left"></div></td>
<td><input type="checkbox" id="#" name="#" class="pull-right" <?= ($o->passive_checks_enabled === '1') ? 'checked="true"' : '' ?> /></td>
<td>
<input type="checkbox" id="#" name="#" class="pull-right" <?= ($o->passive_checks_enabled === '1') ? 'checked="true"' : '' ?> />
</td>
</tr>
<tr>

View File

@ -83,6 +83,13 @@ a {
text-decoration: none;
}
a.button {
height: 30px;
}
a.btn-small {
height: 25px;
}
/**
* Address `outline` inconsistency between Chrome and other browsers.
*/
@ -239,6 +246,9 @@ td {
Forms
========================================================================== */
.panel-row form {
display: inline;
}
.form-inline .form-group {
display: inline-block;
@ -258,11 +268,7 @@ label {
.input-sm {
border-radius: 3px;
font-size: 16px;
padding: 5px;
margin-right: 15px;
}
.form-control {
background-color: #FFFFFF;