summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-03-10 20:34:57 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-03-10 20:34:57 +0000
commitb34b8b023e3901e5a3c29d0e3e698b7ce3614017 (patch)
treebe01827642f67aae5d920026686701b0ddf954f7 /modules
parent75f42e323f3f1f083529897f3f18a1b2009788f9 (diff)
downloadbrdo-b34b8b023e3901e5a3c29d0e3e698b7ce3614017.tar.gz
brdo-b34b8b023e3901e5a3c29d0e3e698b7ce3614017.tar.bz2
#674852 follow-up by casey and aspilicious: Fix overlay tab behaviours.
Diffstat (limited to 'modules')
-rw-r--r--modules/overlay/overlay-parent.js63
1 files changed, 44 insertions, 19 deletions
diff --git a/modules/overlay/overlay-parent.js b/modules/overlay/overlay-parent.js
index dd064faa3..4cee5f452 100644
--- a/modules/overlay/overlay-parent.js
+++ b/modules/overlay/overlay-parent.js
@@ -273,32 +273,57 @@ Drupal.overlay.load = function (url) {
self.isLoading = true;
- self.$iframeWindow = null;
- self.$iframeDocument = null;
- self.$iframeBody = null;
-
- // No need to resize while loading.
- clearTimeout(self.resizeTimeoutID);
-
// Change the overlay title.
self.$container.dialog('option', 'title', Drupal.t('Loading...'));
// Remove any existing shortcut button markup in the title section.
self.$dialogTitlebar.find('.add-or-remove-shortcuts').remove();
+
// Remove any existing tabs in the title section, but only if requested url
- // is not one of those tabs. If the latter, set that tab active.
- var urlPath = self.getPath(url);
- var $tabs = self.$dialogTitlebar.find('ul');
- var $tabsLinks = $tabs.find('> li > a');
- var $activeLink = $tabsLinks.filter(function () { return self.getPath(this) == urlPath; });
- if ($activeLink.length) {
- var active_tab = Drupal.t('(active tab)');
- $tabsLinks.parent().removeClass('active').find('element-invisible:contains(' + active_tab + ')').appendTo($activeLink);
- $activeLink.parent().addClass('active');
- }
- else {
- $tabs.remove();
+ // is not one of those tabs. If the latter, set that tab active. Only check
+ // for tabs when the overlay is not empty.
+ if (self.$iframeBody) {
+ var urlPath = self.getPath(url);
+
+ // Get the primary tabs
+ var $tabs = self.$dialogTitlebar.find('ul');
+ var $tabsLinks = $tabs.find('> li > a');
+
+ // Check if clicked on a primary tab
+ var $activeLink = $tabsLinks.filter(function () { return self.getPath(this) == urlPath; });
+
+ if ($activeLink.length) {
+ var active_tab = Drupal.t('(active tab)');
+ $tabsLinks.parent().removeClass('active').find('element-invisible:contains(' + active_tab + ')').appendTo($activeLink);
+ $activeLink.parent().addClass('active');
+ removeTabs = false;
+ }
+ else {
+ // Get the secondary tabs
+ var $secondary = self.$iframeBody.find('ul.secondary');
+ var $secondaryLinks = $secondary.find('> li > a');
+
+ // Check if clicked on a secondary tab
+ var $activeLinkSecondary = $secondaryLinks.filter(function () { return self.getPath(this) == urlPath; });
+
+ if ($activeLinkSecondary.length) {
+ var active_tab = Drupal.t('(active tab)');
+ $secondaryLinks.parent().removeClass('active').find('element-invisible:contains(' + active_tab + ')').appendTo($activeLinkSecondary);
+ $activeLinkSecondary.parent().addClass('active');
+ removeTabs = false;
+ }
+ else {
+ $tabs.remove();
+ }
+ }
}
+ self.$iframeWindow = null;
+ self.$iframeDocument = null;
+ self.$iframeBody = null;
+
+ // No need to resize while loading.
+ clearTimeout(self.resizeTimeoutID);
+
// While the overlay is loading, we remove the loaded class from the dialog.
// After the loading is finished, the loaded class is added back. The loaded
// class is being used to hide the iframe while loading.