diff --git a/CHANGELOG.txt b/CHANGELOG.txt index e4fe769258..1c89255826 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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) diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 84e70d9707..23b2e9da1e 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -273,6 +273,7 @@ Contributors * Mary Kate Fain * Dário Marcelino * Dave Bell +* Ben Weatherman Translators =========== diff --git a/docs/releases/2.1.rst b/docs/releases/2.1.rst index 98c769b7ca..15ee5d2a2f 100644 --- a/docs/releases/2.1.rst +++ b/docs/releases/2.1.rst @@ -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 ~~~~~~~~~ diff --git a/wagtail/admin/static_src/wagtailadmin/js/core.js b/wagtail/admin/static_src/wagtailadmin/js/core.js index eef2672bf4..2ca27b1eaa 100644 --- a/wagtail/admin/static_src/wagtailadmin/js/core.js +++ b/wagtail/admin/static_src/wagtailadmin/js/core.js @@ -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) {