Skip to content

Commit e9951a6

Browse files
committed
wip
1 parent fa23e86 commit e9951a6

3 files changed

Lines changed: 34 additions & 0 deletions

File tree

application/controllers/HistoryController.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@
1010
use Icinga\Module\Icingadb\Web\Controller;
1111
use Icinga\Module\Icingadb\Web\Control\ViewModeSwitcher;
1212
use Icinga\Module\Icingadb\Widget\ItemList\LoadMoreObjectList;
13+
use ipl\Html\Attributes;
14+
use ipl\Html\HtmlElement;
1315
use ipl\Stdlib\Filter;
1416
use ipl\Web\Control\LimitControl;
1517
use ipl\Web\Control\SortControl;
1618
use ipl\Web\Url;
19+
use ipl\Web\Widget\ButtonLink;
1720

1821
class HistoryController extends Controller
1922
{
@@ -109,7 +112,14 @@ public function indexAction()
109112
if ($compact && $page > 1) {
110113
$this->document->addFrom($historyList);
111114
} else {
115+
$this->addContent(new HtmlElement('span', new Attributes(['id' => 'page-1'])));
112116
$this->addContent($historyList);
117+
$this->addContent(new ButtonLink(
118+
'',
119+
$this->getRequest()->getUrl() . '#page-1',
120+
'angles-up',
121+
new Attributes(['class' => 'scroll-to-top', 'title' => $this->translate('Scroll to top')])
122+
));
113123
}
114124

115125
if (! $searchBar->hasBeenSubmitted() && $searchBar->hasBeenSent()) {

public/css/common.less

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,3 +309,26 @@ form[name="form_confirm_removal"] {
309309
opacity: .9;
310310
}
311311
}
312+
313+
.scroll-to-top {
314+
.rounded-corners(50%);
315+
316+
position: absolute;
317+
right: 1em;
318+
bottom: 1em;
319+
font-size: 2em;
320+
line-height: .75em;
321+
padding: .5em;
322+
323+
-webkit-box-shadow: 0 0 1/3em rgba(0,0,0,.3);
324+
-moz-box-shadow: 0 0 1/3em rgba(0,0,0,.3);
325+
box-shadow: 0 0 1/3em rgba(0,0,0,.3);
326+
327+
&:hover {
328+
background: @gray-light;
329+
}
330+
331+
i.icon::before {
332+
margin-right: 0;
333+
}
334+
}

public/js/action-list.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,7 @@
643643

644644
// Set data-icinga-url to make it available for Icinga.History.getCurrentState()
645645
req.$target.closest('.container').data('icingaUrl', url);
646+
req.$target.next('.scroll-to-top').attr('href', url.split('#')[0] + '#page-1');
646647

647648
this.icinga.history.replaceCurrentState();
648649
});

0 commit comments

Comments
 (0)