MDL-59639 theme_boost: remember last visited tab

This commit is contained in:
Bas Brands 2019-06-27 12:27:03 +02:00
parent 414eca8923
commit fbd99bbb00
4 changed files with 29 additions and 2 deletions

View File

@ -1,2 +1,2 @@
define ("theme_boost/loader",["jquery","./tether","core/event"],function(a,b,c){window.jQuery=a;window.Tether=b;require(["theme_boost/aria","theme_boost/pending","theme_boost/util","theme_boost/alert","theme_boost/button","theme_boost/carousel","theme_boost/collapse","theme_boost/dropdown","theme_boost/modal","theme_boost/scrollspy","theme_boost/tab","theme_boost/tooltip","theme_boost/popover"],function(b){a("body").popover({trigger:"focus",selector:"[data-toggle=popover][data-trigger!=hover]"});a("html").popover({container:"body",selector:"[data-toggle=popover][data-trigger=hover]",trigger:"hover",delay:{hide:500}});a.fn.dropdown.Constructor.Default.flip=!1;c.getLegacyEvents().done(function(b){a(document).on(b.FILTER_CONTENT_UPDATED,function(){a("body").popover({selector:"[data-toggle=\"popover\"]",trigger:"focus"})})});b.init()});return{}});
define ("theme_boost/loader",["jquery","./tether","core/event"],function(a,b,c){window.jQuery=a;window.Tether=b;require(["theme_boost/aria","theme_boost/pending","theme_boost/util","theme_boost/alert","theme_boost/button","theme_boost/carousel","theme_boost/collapse","theme_boost/dropdown","theme_boost/modal","theme_boost/scrollspy","theme_boost/tab","theme_boost/tooltip","theme_boost/popover"],function(b){a("body").popover({trigger:"focus",selector:"[data-toggle=popover][data-trigger!=hover]"});a("html").popover({container:"body",selector:"[data-toggle=popover][data-trigger=hover]",trigger:"hover",delay:{hide:500}});a.fn.dropdown.Constructor.Default.flip=!1;a("a[data-toggle=\"tab\"]").on("shown.bs.tab",function(b){var c=a(b.target).attr("href");if(history.replaceState){history.replaceState(null,null,c)}else{location.hash=c}});var d=window.location.hash;if(d){a(".nav-link[href=\""+d+"\"]").tab("show")}c.getLegacyEvents().done(function(b){a(document).on(b.FILTER_CONTENT_UPDATED,function(){a("body").popover({selector:"[data-toggle=\"popover\"]",trigger:"focus"})})});b.init()});return{}});
//# sourceMappingURL=loader.min.js.map

File diff suppressed because one or more lines are too long

View File

@ -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() {

View File

@ -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"