Skip to content

Commit 385be49

Browse files
committed
Add button to controls section
1 parent 837a608 commit 385be49

File tree

3 files changed

+18
-26
lines changed

3 files changed

+18
-26
lines changed

application/controllers/HistoryController.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use ipl\Web\Control\LimitControl;
1717
use ipl\Web\Control\SortControl;
1818
use ipl\Web\Url;
19+
use ipl\Web\Widget\ActionLink;
1920
use ipl\Web\Widget\ButtonLink;
2021

2122
class HistoryController extends Controller
@@ -92,6 +93,14 @@ public function indexAction()
9293

9394
yield $this->export($history);
9495

96+
$this->addControl(
97+
new ActionLink(
98+
'Scroll to top',
99+
$this->getRequest()->getUrl() . '#page-1',
100+
'angles-up',
101+
new Attributes(['class' => 'scroll-to-top'])
102+
)
103+
);
95104
$this->addControl($sortControl);
96105
$this->addControl($limitControl);
97106
$this->addControl($viewModeSwitcher);
@@ -114,12 +123,6 @@ public function indexAction()
114123
} else {
115124
$this->addContent(new HtmlElement('span', new Attributes(['id' => 'page-1'])));
116125
$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-
));
123126
}
124127

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

public/css/common.less

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -311,24 +311,13 @@ form[name="form_confirm_removal"] {
311311
}
312312

313313
.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-
}
314+
border-radius: .4em;
315+
padding: .25em;
316+
display: inline-flex;
317+
align-items: baseline;
318+
}
330319

331-
i.icon::before {
332-
margin-right: 0;
333-
}
320+
.scroll-to-top:hover {
321+
background: @control-hover-bg;
322+
text-decoration: none;
334323
}

public/js/action-list.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +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');
646+
req.$target.closest('.container').find('.controls .scroll-to-top').attr('href', url.split('#')[0] + '#page-1');
647647

648648
this.icinga.history.replaceCurrentState();
649649
});

0 commit comments

Comments
 (0)