summaryrefslogtreecommitdiff
path: root/modules/overlay
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-07-31 12:54:59 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-07-31 12:54:59 +0000
commit9588a5b38b2e607c8c3253a56585eedc80481d2b (patch)
tree0e02421b4a15c97caa8493366db8523ed4f626dc /modules/overlay
parentf8dea099d7dab1585ad23debf923695f07b33af6 (diff)
downloadbrdo-9588a5b38b2e607c8c3253a56585eedc80481d2b.tar.gz
brdo-9588a5b38b2e607c8c3253a56585eedc80481d2b.tar.bz2
#655416 by casey, yoroy, BTMash, Bojhan, Gábor Hojtsy, sun, ksenzee, oseldman, jrguitar21, et al: 'Demonstrate block preview' should not open in the overlay, and should reflect the regions in the front-end theme.
Diffstat (limited to 'modules/overlay')
-rw-r--r--modules/overlay/overlay-parent.js17
-rw-r--r--modules/overlay/overlay.module1
2 files changed, 14 insertions, 4 deletions
diff --git a/modules/overlay/overlay-parent.js b/modules/overlay/overlay-parent.js
index bb3067857..a3e9d017d 100644
--- a/modules/overlay/overlay-parent.js
+++ b/modules/overlay/overlay-parent.js
@@ -481,7 +481,12 @@ Drupal.overlay.eventhandlerOverrideLink = function (event) {
}
// Open admin links in the overlay.
else if (this.isAdminLink(href)) {
- href = this.fragmentizeLink($target.get(0));
+ // If the link contains the overlay-restore class and the overlay-context
+ // state is set, also update the parent window's location.
+ var parentLocation = ($target.hasClass('overlay-restore') && typeof $.bbq.getState('overlay-context') == 'string')
+ ? Drupal.settings.basePath + $.bbq.getState('overlay-context')
+ : null;
+ href = this.fragmentizeLink($target.get(0), parentLocation);
// Only override default behavior when left-clicking and user is not
// pressing the ALT, CTRL, META (Command key on the Macintosh keyboard)
// or SHIFT key.
@@ -513,6 +518,10 @@ Drupal.overlay.eventhandlerOverrideLink = function (event) {
}
}
else {
+ // Add the overlay-context state to the link, so "overlay-restore" links
+ // can restore the context.
+ $target.attr('href', $.param.fragment(href, { 'overlay-context': this.getPath(window.location) + window.location.search }));
+
// When the link has a destination query parameter and that destination
// is an admin link we need to fragmentize it. This will make it reopen
// in the overlay.
@@ -666,12 +675,14 @@ Drupal.overlay.eventhandlerDispatchEvent = function (event) {
*
* @param link
* A Javascript Link object (i.e. an <a> element).
+ * @param parentLocation
+ * (optional) URL to override the parent window's location with.
*
* @return
* A URL that will trigger the overlay (in the form
* /node/1#overlay=admin/config).
*/
-Drupal.overlay.fragmentizeLink = function (link) {
+Drupal.overlay.fragmentizeLink = function (link, parentLocation) {
// Don't operate on links that are already overlay-ready.
var params = $.deparam.fragment(link.href);
if (params.overlay) {
@@ -687,7 +698,7 @@ Drupal.overlay.fragmentizeLink = function (link) {
var destination = path + link.search.replace(/&?render=overlay/, '').replace(/\?$/, '') + link.hash;
// Assemble and return the overlay-ready link.
- return $.param.fragment(window.location.href, { overlay: destination });
+ return $.param.fragment(parentLocation || window.location.href, { overlay: destination });
};
/**
diff --git a/modules/overlay/overlay.module b/modules/overlay/overlay.module
index 5537ddf0e..edf584adf 100644
--- a/modules/overlay/overlay.module
+++ b/modules/overlay/overlay.module
@@ -542,7 +542,6 @@ function overlay_set_mode($mode = NULL) {
switch ($overlay_mode) {
case 'parent':
drupal_add_library('overlay', 'parent');
- drupal_add_library('overlay', 'jquery-bbq');
// Allow modules to act upon overlay events.
module_invoke_all('overlay_parent_initialize');