Use last settings page with GS shortcut

This commit is contained in:
Hillel Coren 2017-03-07 12:10:00 +02:00
parent 3dee1692c2
commit 01834935ca
3 changed files with 29 additions and 6 deletions

View File

@ -6,6 +6,22 @@
</div> </div>
@endif @endif
<script type="text/javascript">
$(function() {
if (isStorageSupported()) {
localStorage.setItem('last:settings_page', location.href);
}
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
var target = $(e.target).attr("href") // activated tab
if (history.pushState) {
history.pushState(null, null, target);
}
});
})
</script>
<div class="row"> <div class="row">
<div class="col-md-3"> <div class="col-md-3">

View File

@ -337,6 +337,9 @@
if (history.pushState) { if (history.pushState) {
history.pushState(null, null, target); history.pushState(null, null, target);
} }
if (isStorageSupported() && /\/settings\//.test(location.href)) {
localStorage.setItem('last:settings_page', location.href);
}
}); });
}); });

View File

@ -103,7 +103,11 @@
}); });
Mousetrap.bind('g s', function(e) { Mousetrap.bind('g s', function(e) {
location.href = "{{ url('/settings/company_details') }}"; var url = '{{ url('/settings/company_details') }}';
if (isStorageSupported()) {
url = localStorage.getItem('last:settings_page') || url;
}
location.href = url;
}); });
Mousetrap.bind('h', function(e) { Mousetrap.bind('h', function(e) {