Skip to content
This repository has been archived by the owner on Nov 23, 2020. It is now read-only.

Commit

Permalink
Enable deep link to tab
Browse files Browse the repository at this point in the history
This is a non breaking change that:

- Combined with CRUD tabs, or standalone, allow you to click on a Tab and have URL filled with current tab, for easy copy&paste
- Allows to deep link any tab in a tabbed interface/form/whatever
  • Loading branch information
MarcosBL authored Apr 12, 2017
1 parent d1d92fc commit 9e4786b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/resources/views/layout.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@
$(this).parents('li').addClass('active');
}
});
{{-- Enable deep link to tab --}}
var activeTab = $('[href="' + location.hash.replace("#", "#tab_") + '"]');
activeTab && activeTab.tab('show');
$('.nav-tabs a').on('shown.bs.tab', function (e) {
location.hash = e.target.hash.replace("#tab_", "#");
});
</script>

@include('backpack::inc.alerts')
Expand Down

0 comments on commit 9e4786b

Please sign in to comment.