From 80d479f3f0f7c477c1c25b04f731040271d038f8 Mon Sep 17 00:00:00 2001 From: rolux Date: Mon, 4 Mar 2013 12:54:06 +0000 Subject: [PATCH] in dialogs that correspond to pages, make sure that on close, we only set page to '' if the close happened via the dialog, and not in the app panel's page change handler --- static/js/pandora/helpDialog.js | 4 ++-- static/js/pandora/preferencesDialog.js | 14 ++++++-------- static/js/pandora/siteDialog.js | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/static/js/pandora/helpDialog.js b/static/js/pandora/helpDialog.js index 820bd595..15a6bbc5 100644 --- a/static/js/pandora/helpDialog.js +++ b/static/js/pandora/helpDialog.js @@ -30,7 +30,7 @@ pandora.ui.helpDialog = function() { buttons: [ Ox.Button({ id: 'switch', - title: pandora.site.site.name + ' API...' + title: 'API Documentation...' }).bindEvent({ click: function() { pandora.UI.set({page: 'api', 'hash.anchor': ''}) @@ -59,7 +59,7 @@ pandora.ui.helpDialog = function() { }) .bindEvent({ close: function() { - pandora.UI.set({page: '', 'hash.anchor': ''}); + pandora.user.ui.page == 'help' && pandora.UI.set({page: '', 'hash.anchor': ''}); }, resize: function() { $list.size(); diff --git a/static/js/pandora/preferencesDialog.js b/static/js/pandora/preferencesDialog.js index a67aaa44..de640c8f 100644 --- a/static/js/pandora/preferencesDialog.js +++ b/static/js/pandora/preferencesDialog.js @@ -133,7 +133,6 @@ pandora.ui.preferencesDialog = function() { title: 'Sign Out...' }).bindEvent({ click: function() { - $dialog.close(); pandora.UI.set({page: 'signout'}); } }), @@ -154,13 +153,12 @@ pandora.ui.preferencesDialog = function() { minWidth: 432, title: 'Preferences', width: 432 - }), - closeDialog = $dialog.close; - - $dialog.close = function() { - closeDialog(); - pandora.UI.set({page: ''}); - }; + }) + .bindEvent({ + close: function() { + pandora.user.ui.page == 'preferences' && pandora.UI.set({page: ''}); + } + }); return $dialog; diff --git a/static/js/pandora/siteDialog.js b/static/js/pandora/siteDialog.js index d49d0e23..583038d0 100644 --- a/static/js/pandora/siteDialog.js +++ b/static/js/pandora/siteDialog.js @@ -118,7 +118,7 @@ pandora.ui.siteDialog = function(section) { }) .bindEvent({ close: function(data) { - pandora.UI.set({page: ''}); + Ox.getObjectById(tabs, pandora.user.ui.page) && pandora.UI.set({page: ''}); }, resize: function(data) { var selected = $tabPanel.selected();