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,9 +676,9 @@ class FilterEditor extends AbstractWidget
public function render() public function render()
{ {
if (! $this->preservedUrl()->getParam('modifyFilter')) { if (! $this->preservedUrl()->getParam('modifyFilter')) {
return $this->renderSearch() . $this->shorten($this->filter, 50); $filterEditor = $this->renderSearch() . $this->shorten($this->filter, 50);
} } else {
return $this->renderSearch() $filterEditor = $this->renderSearch()
. '<form action="' . '<form action="'
. Url::fromRequest() . Url::fromRequest()
. '" class="filterEditor" method="POST">' . '" class="filterEditor" method="POST">'
@ -692,6 +692,14 @@ class FilterEditor extends AbstractWidget
. '</form>'; . '</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) protected function shorten($string, $length)
{ {
if (strlen($string) > $length) { if (strlen($string) > $length) {

View File

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

View File

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