Filter form restyle dirty preview
This commit is contained in:
parent
e480ed7aad
commit
4d48f4fb0e
|
@ -31,6 +31,7 @@ namespace Icinga\Web\Widget;
|
||||||
|
|
||||||
use Zend_View_Abstract;
|
use Zend_View_Abstract;
|
||||||
|
|
||||||
|
use Icinga\Web\Widget\AbstractWidget;
|
||||||
use Icinga\Web\Form;
|
use Icinga\Web\Form;
|
||||||
use Icinga\Web\Url;
|
use Icinga\Web\Url;
|
||||||
use Icinga\Filter\Query\Tree;
|
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
|
* 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
|
* An optional initial filter to use
|
||||||
|
@ -94,7 +95,7 @@ EOT;
|
||||||
{
|
{
|
||||||
|
|
||||||
$form = new Form();
|
$form = new Form();
|
||||||
$form->setAttrib('class', 'form-inline');
|
$form->setAttrib('class', 'inline');
|
||||||
$form->setMethod('GET');
|
$form->setMethod('GET');
|
||||||
$form->setAction(Url::fromPath('/filter'));
|
$form->setAction(Url::fromPath('/filter'));
|
||||||
$form->setTokenDisabled();
|
$form->setTokenDisabled();
|
||||||
|
@ -107,10 +108,11 @@ EOT;
|
||||||
'placeholder' => 'Add filter'
|
'placeholder' => 'Add filter'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$form->removeAttrib('data-icinga-component');
|
$query = $form->getElement('query')->setDecorators(array('ViewHelper'));
|
||||||
|
|
||||||
$form->setIgnoreChangeDiscarding(true);
|
|
||||||
$badges = new FilterBadgeRenderer($this->initialFilter);
|
$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 = str_replace('{{FORM}}', $form->render($view), self::$TPL);
|
||||||
$html = '<div class="input-append">' . $html . '</div>';
|
$html = '<div class="input-append">' . $html . '</div>';
|
||||||
return str_replace('{{BADGES}}', $badges->render($view), $html);
|
return str_replace('{{BADGES}}', $badges->render($view), $html);
|
||||||
|
|
|
@ -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
|
* 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(
|
array(
|
||||||
'name' => 'submit_' . $this->name,
|
'name' => 'submit_' . $this->name,
|
||||||
'label' => 'Sort',
|
'label' => 'Sort',
|
||||||
'class' => 'btn btn-default',
|
'class' => '',
|
||||||
'condition' => 0,
|
'condition' => 0,
|
||||||
'value' => '{{SUBMIT_ICON}}'
|
'value' => '{{SUBMIT_ICON}}'
|
||||||
)
|
)
|
||||||
|
@ -139,7 +139,7 @@ class SortBox implements Widget
|
||||||
public function render(Zend_View_Abstract $view)
|
public function render(Zend_View_Abstract $view)
|
||||||
{
|
{
|
||||||
$form = new Form();
|
$form = new Form();
|
||||||
$form->setAttrib('class', 'form-inline');
|
$form->setAttrib('class', 'inline');
|
||||||
$form->setMethod('GET');
|
$form->setMethod('GET');
|
||||||
$form->setTokenDisabled();
|
$form->setTokenDisabled();
|
||||||
$form->setName($this->name);
|
$form->setName($this->name);
|
||||||
|
@ -148,7 +148,8 @@ class SortBox implements Widget
|
||||||
'sort',
|
'sort',
|
||||||
array(
|
array(
|
||||||
'label' => 'Sort By',
|
'label' => 'Sort By',
|
||||||
'multiOptions' => $this->sortFields
|
'multiOptions' => $this->sortFields,
|
||||||
|
'class' => 'autosubmit'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$form->addElement(
|
$form->addElement(
|
||||||
|
@ -157,19 +158,21 @@ class SortBox implements Widget
|
||||||
array(
|
array(
|
||||||
'multiOptions' => array(
|
'multiOptions' => array(
|
||||||
'desc' => 'Desc',
|
'desc' => 'Desc',
|
||||||
'asc' => 'Asc'
|
'asc' => 'Asc',
|
||||||
|
'class' => 'autosubmit'
|
||||||
)
|
)
|
||||||
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
$sort = $form->getElement('sort')->setDecorators(array('ViewHelper'));
|
||||||
$form->enableAutoSubmit(array('sort', 'dir'));
|
$dir = $form->getElement('dir')->setDecorators(array('ViewHelper'));
|
||||||
$form->addElement($this->createFallbackSubmitButton());
|
// $form->enableAutoSubmit(array('sort', 'dir'));
|
||||||
|
// $form->addElement($this->createFallbackSubmitButton());
|
||||||
|
|
||||||
if ($this->request) {
|
if ($this->request) {
|
||||||
$form->setAction($this->request->getRequestUri());
|
$form->setAction($this->request->getRequestUri());
|
||||||
$form->populate($this->request->getParams());
|
$form->populate($this->request->getParams());
|
||||||
}
|
}
|
||||||
return $form->render($view);
|
return $form;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,15 +3,11 @@ $helper = $this->getHelper('MonitoringState');
|
||||||
?>
|
?>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<?= $this->tabs ?>
|
<?= $this->tabs ?>
|
||||||
<div style="display: inline-block; margin: 1em; vertical-align: top;">
|
<div style="margin: 1em;">
|
||||||
<?= $this->filterBox->render($this); ?>
|
<?= $this->filterBox ?> <?= $this->sortControl->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>
|
</div>
|
||||||
|
<!--<?= $this->selectionToolbar('multi', $this->href('monitoring/multi/host',array( 'host' => '*' ))); ?>-->
|
||||||
|
<div style="margin: 1em;">
|
||||||
<?= $this->paginationControl($hosts, null, null, array('preserve' => $this->preserve)); ?>
|
<?= $this->paginationControl($hosts, null, null, array('preserve' => $this->preserve)); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
|
|
@ -4,14 +4,13 @@ $helper = $this->getHelper('MonitoringState');
|
||||||
if (!$this->compact): ?>
|
if (!$this->compact): ?>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<?= $this->tabs ?>
|
<?= $this->tabs ?>
|
||||||
<div style="display: inline-block; margin: 1em; vertical-align: top;">
|
<div style="margin: 1em;">
|
||||||
<?= $this->filterBox->render($this); ?>
|
<?= $this->filterBox ?>
|
||||||
|
<?= $this->sortControl ?>
|
||||||
|
</div>
|
||||||
|
<div style="margin: 1em;">
|
||||||
|
<?= $this->paginationControl($services, null, null, array('preserve' => $this->preserve)); ?>
|
||||||
</div>
|
</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>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
|
Loading…
Reference in New Issue