From 4d48f4fb0e4a0de368a4393b4632ffd009fb7fd7 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Sun, 9 Mar 2014 02:03:06 +0100 Subject: [PATCH] Filter form restyle dirty preview --- library/Icinga/Web/Widget/FilterBox.php | 10 +++++---- library/Icinga/Web/Widget/SortBox.php | 21 +++++++++++-------- .../views/scripts/list/hosts.phtml | 12 ++++------- .../views/scripts/list/services.phtml | 13 ++++++------ 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/library/Icinga/Web/Widget/FilterBox.php b/library/Icinga/Web/Widget/FilterBox.php index 6c1e48009..6bf08ed51 100644 --- a/library/Icinga/Web/Widget/FilterBox.php +++ b/library/Icinga/Web/Widget/FilterBox.php @@ -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 '
' . $badges->render($view) . '
' . $form; $html = str_replace('{{FORM}}', $form->render($view), self::$TPL); $html = '
' . $html . '
'; return str_replace('{{BADGES}}', $badges->render($view), $html); diff --git a/library/Icinga/Web/Widget/SortBox.php b/library/Icinga/Web/Widget/SortBox.php index 3d4c65310..95baa7a6f 100644 --- a/library/Icinga/Web/Widget/SortBox.php +++ b/library/Icinga/Web/Widget/SortBox.php @@ -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; } } diff --git a/modules/monitoring/application/views/scripts/list/hosts.phtml b/modules/monitoring/application/views/scripts/list/hosts.phtml index 64a6091ca..432560bb2 100644 --- a/modules/monitoring/application/views/scripts/list/hosts.phtml +++ b/modules/monitoring/application/views/scripts/list/hosts.phtml @@ -3,15 +3,11 @@ $helper = $this->getHelper('MonitoringState'); ?>
tabs ?> -
-filterBox->render($this); ?> -
-
-sortControl->render($this); ?> -

-
-selectionToolbar('multi', $this->href('monitoring/multi/host',array( 'host' => '*' ))); ?> +
+filterBox ?> sortControl->render($this); ?>
+ +
paginationControl($hosts, null, null, array('preserve' => $this->preserve)); ?>
diff --git a/modules/monitoring/application/views/scripts/list/services.phtml b/modules/monitoring/application/views/scripts/list/services.phtml index 5c5a00ea3..5503d9c59 100644 --- a/modules/monitoring/application/views/scripts/list/services.phtml +++ b/modules/monitoring/application/views/scripts/list/services.phtml @@ -4,14 +4,13 @@ $helper = $this->getHelper('MonitoringState'); if (!$this->compact): ?>
tabs ?> -
-filterBox->render($this); ?> +
+filterBox ?> +sortControl ?> +
+
+paginationControl($services, null, null, array('preserve' => $this->preserve)); ?>
-
-sortControl->render($this); ?> -

-
-selectionToolbar('multi', $this->href('monitoring/multi/service', array( 'service' => '*', 'host' => '*' ))); ?>
paginationControl($services, null, null, array('preserve' => $this->preserve)); ?>