Filter form restyle dirty preview

This commit is contained in:
Thomas Gelf 2014-03-09 02:03:06 +01:00
parent e480ed7aad
commit 4d48f4fb0e
4 changed files with 28 additions and 28 deletions

View File

@ -31,6 +31,7 @@ namespace Icinga\Web\Widget;
use Zend_View_Abstract;
use Icinga\Web\Widget\AbstractWidget;
use Icinga\Web\Form;
use Icinga\Web\Url;
use Icinga\Filter\Query\Tree;
@ -38,7 +39,7 @@ use Icinga\Filter\Query\Tree;
/**
* Widget that renders a filter input box together with an FilterBadgeRenderer widget
*/
class FilterBox implements Widget
class FilterBox extends AbstractWidget
{
/**
* An optional initial filter to use
@ -94,7 +95,7 @@ EOT;
{
$form = new Form();
$form->setAttrib('class', 'form-inline');
$form->setAttrib('class', 'inline');
$form->setMethod('GET');
$form->setAction(Url::fromPath('/filter'));
$form->setTokenDisabled();
@ -107,10 +108,11 @@ EOT;
'placeholder' => 'Add filter'
)
);
$form->removeAttrib('data-icinga-component');
$query = $form->getElement('query')->setDecorators(array('ViewHelper'));
$form->setIgnoreChangeDiscarding(true);
$badges = new FilterBadgeRenderer($this->initialFilter);
$form->setIgnoreChangeDiscarding(true);
return '<div class="pull-right">' . $badges->render($view) . '</div>' . $form;
$html = str_replace('{{FORM}}', $form->render($view), self::$TPL);
$html = '<div class="input-append">' . $html . '</div>';
return str_replace('{{BADGES}}', $badges->render($view), $html);

View File

@ -58,7 +58,7 @@ use Zend_Form_Element_Submit;
* By default the sortBox uses the GET parameter 'sort' for the sorting key and 'dir' for the sorting direction
*
*/
class SortBox implements Widget
class SortBox extends AbstractWidget
{
/**
@ -118,7 +118,7 @@ class SortBox implements Widget
array(
'name' => 'submit_' . $this->name,
'label' => 'Sort',
'class' => 'btn btn-default',
'class' => '',
'condition' => 0,
'value' => '{{SUBMIT_ICON}}'
)
@ -139,7 +139,7 @@ class SortBox implements Widget
public function render(Zend_View_Abstract $view)
{
$form = new Form();
$form->setAttrib('class', 'form-inline');
$form->setAttrib('class', 'inline');
$form->setMethod('GET');
$form->setTokenDisabled();
$form->setName($this->name);
@ -148,7 +148,8 @@ class SortBox implements Widget
'sort',
array(
'label' => 'Sort By',
'multiOptions' => $this->sortFields
'multiOptions' => $this->sortFields,
'class' => 'autosubmit'
)
);
$form->addElement(
@ -157,19 +158,21 @@ class SortBox implements Widget
array(
'multiOptions' => array(
'desc' => 'Desc',
'asc' => 'Asc'
'asc' => 'Asc',
'class' => 'autosubmit'
)
)
);
$form->enableAutoSubmit(array('sort', 'dir'));
$form->addElement($this->createFallbackSubmitButton());
$sort = $form->getElement('sort')->setDecorators(array('ViewHelper'));
$dir = $form->getElement('dir')->setDecorators(array('ViewHelper'));
// $form->enableAutoSubmit(array('sort', 'dir'));
// $form->addElement($this->createFallbackSubmitButton());
if ($this->request) {
$form->setAction($this->request->getRequestUri());
$form->populate($this->request->getParams());
}
return $form->render($view);
return $form;
}
}

View File

@ -3,15 +3,11 @@ $helper = $this->getHelper('MonitoringState');
?>
<div class="controls">
<?= $this->tabs ?>
<div style="display: inline-block; margin: 1em; vertical-align: top;">
<?= $this->filterBox->render($this); ?>
</div>
<div style="display: inline-block; margin: 1em; vertical-align: top;">
<?= $this->sortControl->render($this); ?>
</div><br />
<div style="display: inline-block; margin: 1em; vertical-align: top;">
<?= $this->selectionToolbar('multi', $this->href('monitoring/multi/host',array( 'host' => '*' ))); ?>
<div style="margin: 1em;">
<?= $this->filterBox ?> <?= $this->sortControl->render($this); ?>
</div>
<!--<?= $this->selectionToolbar('multi', $this->href('monitoring/multi/host',array( 'host' => '*' ))); ?>-->
<div style="margin: 1em;">
<?= $this->paginationControl($hosts, null, null, array('preserve' => $this->preserve)); ?>
</div>
<div class="content">

View File

@ -4,14 +4,13 @@ $helper = $this->getHelper('MonitoringState');
if (!$this->compact): ?>
<div class="controls">
<?= $this->tabs ?>
<div style="display: inline-block; margin: 1em; vertical-align: top;">
<?= $this->filterBox->render($this); ?>
<div style="margin: 1em;">
<?= $this->filterBox ?>
<?= $this->sortControl ?>
</div>
<div style="margin: 1em;">
<?= $this->paginationControl($services, null, null, array('preserve' => $this->preserve)); ?>
</div>
<div style="display: inline-block; margin: 1em; vertical-align: top;">
<?= $this->sortControl->render($this); ?>
</div><br />
<div style="display: inline-block; margin: 1em; vertical-align: top;">
<?= $this->selectionToolbar('multi', $this->href('monitoring/multi/service', array( 'service' => '*', 'host' => '*' ))); ?></div> <?= $this->paginationControl($services, null, null, array('preserve' => $this->preserve)); ?>
</div>
<div class="content">