diff --git a/library/Icinga/Web/Widget/FilterWidget.php b/library/Icinga/Web/Widget/FilterWidget.php index 37227a654..c86c550d8 100644 --- a/library/Icinga/Web/Widget/FilterWidget.php +++ b/library/Icinga/Web/Widget/FilterWidget.php @@ -72,11 +72,12 @@ class FilterWidget extends AbstractWidget public function render() { $url = Url::fromRequest(); + $view = $this->view(); $html = '

'; + . '" />'; // $html .= $this->renderFilter($this->filter); @@ -84,8 +85,8 @@ class FilterWidget extends AbstractWidget $editorUrl = clone $url; $editorUrl->setParam('modifyFilter', true); if ($this->filter->isEmpty()) { - $txt = t('Filter'); $title = t('Filter this list'); + $txt = $view->icon('create.png', $title); $remove = ''; } else { $txt = t('Filtered'); @@ -95,13 +96,26 @@ class FilterWidget extends AbstractWidget . '" title="' . t('Remove this filter') . '">' - . t('remove') + . $view->icon('remove.png', $title) . ''; } $filter = $this->filter->isEmpty() ? '' : ': ' . $this->filter; - $html .= '' . $this->view()->escape($txt) . '' - . $filter . $remove; + $html .= ($filter ? '

' : ' ') + . '' + . $txt + . '' + . $this->shorten($filter, 72) + . $remove + . ($filter ? '

' : ''); return $html; } + + protected function shorten($string, $length) + { + if (strlen($string) > $length) { + return substr($string, 0, $length) . '...'; + } + return $string; + } }