Skip to content

Commit

Permalink
MDL-59639 theme_boost: remember last visited tab
Browse files Browse the repository at this point in the history
  • Loading branch information
Bas Brands committed Aug 6, 2019
1 parent 414eca8 commit fbd99bb
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion theme/boost/amd/build/loader.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion theme/boost/amd/build/loader.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions theme/boost/amd/src/loader.js
Expand Up @@ -61,6 +61,20 @@ define(['jquery', './tether', 'core/event'], function(jQuery, Tether, Event) {
// Disables flipping the dropdowns up and getting hidden behind the navbar.
jQuery.fn.dropdown.Constructor.Default.flip = false;

jQuery('a[data-toggle="tab"]').on('shown.bs.tab', function(e) {
var hash = jQuery(e.target).attr('href');
if (history.replaceState) {
history.replaceState(null, null, hash);
} else {
location.hash = hash;
}
});

var hash = window.location.hash;
if (hash) {
jQuery('.nav-link[href="' + hash + '"]').tab('show');
}

// We need to call popover automatically if nodes are added to the page later.
Event.getLegacyEvents().done(function(events) {
jQuery(document).on(events.FILTER_CONTENT_UPDATED, function() {
Expand Down
13 changes: 13 additions & 0 deletions theme/boost/tests/behat/settingstabs.feature
@@ -0,0 +1,13 @@
@javascript @theme_boost
Feature: Administration nav tabs back
When returning to the Administration page I want to see my last opened tab

Scenario: See last opened tab in site admin
Given I log in as "admin"
And I am on site homepage
And I click on "Site administration" "link"
And I click on "Users" "link"
And I click on "Browse list of users" "link"
And I should see "New filter"
When I press the "back" button in the browser
Then I should see "Cohorts"

0 comments on commit fbd99bb

Please sign in to comment.