Header: Add header to event history

Add header to the following widgets:

- FilterEditor
- SortBox

refs #7976
This commit is contained in:
Marius Hein 2015-02-23 14:23:56 +01:00
parent 6f2d428254
commit 03160ef81a
4 changed files with 35 additions and 21 deletions

View File

@ -676,20 +676,28 @@ class FilterEditor extends AbstractWidget
public function render()
{
if (! $this->preservedUrl()->getParam('modifyFilter')) {
return $this->renderSearch() . $this->shorten($this->filter, 50);
$filterEditor = $this->renderSearch() . $this->shorten($this->filter, 50);
} else {
$filterEditor = $this->renderSearch()
. '<form action="'
. Url::fromRequest()
. '" class="filterEditor" method="POST">'
. '<ul class="tree widgetFilter"><li>'
. $this->renderFilter($this->filter)
. '</li></ul>'
. '<div style="float: right">'
. '<input type="submit" name="submit" value="Apply" />'
. '<input type="submit" name="cancel" value="Cancel" />'
. '</div>'
. '</form>';
}
return $this->renderSearch()
. '<form action="'
. Url::fromRequest()
. '" class="filterEditor" method="POST">'
. '<ul class="tree widgetFilter"><li>'
. $this->renderFilter($this->filter)
. '</li></ul>'
. '<div style="float: right">'
. '<input type="submit" name="submit" value="Apply" />'
. '<input type="submit" name="cancel" value="Cancel" />'
. '</div>'
. '</form>';
return sprintf(
'<div class="filter-editor dontprint">'
. '<h2 tabindex="-1" class="sr-only">%s</h2>%s</div>',
t('Filters'),
$filterEditor
);
}
protected function shorten($string, $length)

View File

@ -133,6 +133,13 @@ class SortBox extends AbstractWidget
if ($this->request) {
$form->populate($this->request->getParams());
}
return $form;
return sprintf(
'<div class="sort-box dontprint">'
. '<h2 tabindex="-1" class="sr-only">%s</h2>%s%s</div>',
t('Sort Criteria'),
t('Sort by'),
(string) $form
);
}
}

View File

@ -4,16 +4,10 @@ use Icinga\Module\Monitoring\Object\Host;
use Icinga\Module\Monitoring\Object\Service;
?>
<?php if (false === $this->compact): ?>
<div class="controls">
<?= $this->tabs ?>
<div style="margin: 1em" class="dontprint">
<div style="float: right">
<?= $this->translate('Sort by') ?> <?= $this->sortControl ?>
</div>
</div>
<?= $this->sortControl ?>
<?= $this->widget('limiter', array('url' => $this->url, 'max' => $this->history->count())); ?>
<?= $this->paginationControl($history, null, null, array('preserve' => $this->preserve)); ?>
@ -22,6 +16,7 @@ use Icinga\Module\Monitoring\Object\Service;
<div class="content">
<?= $this->filterEditor ?>
<h1 tabindex="-1"><?= $this->translate('Event History') ?></h1>
<?php if (empty($history)): ?>
<?= $this->translate('No history events matching the filter') ?>
</div>

View File

@ -198,3 +198,7 @@ hr.command-separator {
border: none;
border-bottom: 2px solid @colorPetrol;
}
.sort-box {
float: right;
}