Commit 69f7a1ef authored by webchick's avatar webchick

Issue #2167611 by nod_: Back to site button broken.

parent c241c1ba
...@@ -7,14 +7,15 @@ ...@@ -7,14 +7,15 @@
"use strict"; "use strict";
var pathInfo = drupalSettings.path;
var escapeAdminPath = sessionStorage.getItem('escapeAdminPath'); var escapeAdminPath = sessionStorage.getItem('escapeAdminPath');
// Saves the last non-administrative page in the browser to be able to link back // Saves the last non-administrative page in the browser to be able to link back
// to it when browsing administrative pages. If there is a destination parameter // to it when browsing administrative pages. If there is a destination parameter
// there is not need to save the current path because the page is loaded within // there is not need to save the current path because the page is loaded within
// an existing "workflow". // an existing "workflow".
if (!drupalSettings.currentPathIsAdmin && !/destination=/.test(window.location.search)) { if (!pathInfo.currentPathIsAdmin && !/destination=/.test(window.location.search)) {
sessionStorage.setItem('escapeAdminPath', drupalSettings.currentPath); sessionStorage.setItem('escapeAdminPath', pathInfo.currentPath);
} }
/** /**
...@@ -27,7 +28,7 @@ Drupal.behaviors.escapeAdmin = { ...@@ -27,7 +28,7 @@ Drupal.behaviors.escapeAdmin = {
attach: function () { attach: function () {
var $toolbarEscape = $('[data-toolbar-escape-admin]').once('escapeAdmin'); var $toolbarEscape = $('[data-toolbar-escape-admin]').once('escapeAdmin');
if ($toolbarEscape.length) { if ($toolbarEscape.length) {
if (drupalSettings.currentPathIsAdmin && escapeAdminPath) { if (pathInfo.currentPathIsAdmin && escapeAdminPath) {
$toolbarEscape.attr('href', Drupal.url(escapeAdminPath)); $toolbarEscape.attr('href', Drupal.url(escapeAdminPath));
$toolbarEscape.closest('.toolbar-tab').removeClass('hidden'); $toolbarEscape.closest('.toolbar-tab').removeClass('hidden');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment