parent
5fa423cf03
commit
98e0081d81
|
@ -4,7 +4,6 @@
|
||||||
namespace Icinga\Web\Widget;
|
namespace Icinga\Web\Widget;
|
||||||
|
|
||||||
use Icinga\Web\Navigation\Navigation;
|
use Icinga\Web\Navigation\Navigation;
|
||||||
use Icinga\Web\Navigation\NavigationItem;
|
|
||||||
use Icinga\Web\Url;
|
use Icinga\Web\Url;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -79,28 +78,30 @@ class Limiter extends AbstractWidget
|
||||||
$navigation = new Navigation();
|
$navigation = new Navigation();
|
||||||
$navigation->setLayout(Navigation::LAYOUT_TABS);
|
$navigation->setLayout(Navigation::LAYOUT_TABS);
|
||||||
foreach (static::$limits as $limit => $label) {
|
foreach (static::$limits as $limit => $label) {
|
||||||
$navigationItem = new NavigationItem($limit);
|
$navigation->addItem(
|
||||||
$navigationItem
|
'limit_' . $limit,
|
||||||
->setActive($activeLimit === $limit)
|
array(
|
||||||
->setAttribute(
|
'priority' => $limit,
|
||||||
'title',
|
'label' => $label,
|
||||||
sprintf(
|
'active' => $activeLimit === $limit,
|
||||||
t('Show %u rows on this page'),
|
'url' => $url->with(array('limit' => $limit)),
|
||||||
$limit
|
'title' => sprintf(t('Show %u rows on this page'), $limit)
|
||||||
)
|
|
||||||
)
|
)
|
||||||
->setLabel($label)
|
);
|
||||||
->setUrl($url->with(array('limit' => $limit)));
|
|
||||||
$navigation->addItem($navigationItem);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($activeLimit === 0) {
|
if ($activeLimit === 0) {
|
||||||
$navigationItem = new NavigationItem(0);
|
$navigation->addItem(
|
||||||
$navigationItem
|
'limit_0',
|
||||||
->setActive(true)
|
array(
|
||||||
->setAttribute('title', t('Show all items on this page'))
|
'active' => true,
|
||||||
->setLabel(t('all'));
|
'label' => t('all'),
|
||||||
$navigation->addItem($navigationItem);
|
'title' => t('Show all items on this page'),
|
||||||
|
'priority' => max(array_keys(static::$limits)) + 1
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $navigation
|
return $navigation
|
||||||
->getRenderer()
|
->getRenderer()
|
||||||
->setCssClass(static::CSS_CLASS_LIMITER)
|
->setCssClass(static::CSS_CLASS_LIMITER)
|
||||||
|
|
Loading…
Reference in New Issue