Persist tab hash in URL to allow direct navigation to tabs in the admin interface (#4231)

Save the hash when clicking on a tab and select the tab if loading a page with a hash in it. This allows for giving direct links to a specific tab.

![tabs](https://user-images.githubusercontent.com/272675/35627540-c8e22f36-065e-11e8-848e-78924335a146.gif)

Fixes wagtail/wagtail#4111
pull/4215/merge
Ben 2018-02-14 03:37:44 -06:00 zatwierdzone przez Thibaud Colas
rodzic 96a0189232
commit 6412bad624
4 zmienionych plików z 10 dodań i 2 usunięć

Wyświetl plik

@ -4,6 +4,7 @@ Changelog
2.1 (xx.xx.xxxx) - IN DEVELOPMENT
~~~~~~~~~~~~~~~~
* Persist tab hash in URL to allow direct navigation to tabs in the admin interface (Ben Weatherman)
* Fix: Status button on 'edit page' now links to the correct URL when live and draft slug differ (LB (Ben Johnston))
* Fix: Image title text in the gallery and in the chooser now wraps for long filenames (LB (Ben Johnston), Luiz Boaretto)

Wyświetl plik

@ -273,6 +273,7 @@ Contributors
* Mary Kate Fain
* Dário Marcelino
* Dave Bell
* Ben Weatherman
Translators
===========

Wyświetl plik

@ -14,6 +14,7 @@ What's new
Other features
~~~~~~~~~~~~~~
* Persist tab hash in URL to allow direct navigation to tabs in the admin interface (Ben Weatherman)
Bug fixes
~~~~~~~~~

Wyświetl plik

@ -173,9 +173,14 @@ $(function() {
});
/* tabs */
if (window.location.hash) {
$('a[href="' + window.location.hash + '"]').tab('show');
}
$(document).on('click', '.tab-nav a', function(e) {
e.preventDefault();
$(this).tab('show');
e.preventDefault();
$(this).tab('show');
window.history.replaceState(null, null, $(this).attr('href'));
});
$(document).on('click', '.tab-toggle', function(e) {