From d3225ad4afeb597b3ce32e0267152c6a954d11bf Mon Sep 17 00:00:00 2001 From: rolux Date: Fri, 4 Nov 2011 18:10:48 +0000 Subject: [PATCH] remove dialogs with state --- pandora/itemlist/models.py | 4 ++-- pandora/urls.py | 2 ++ static/js/pandora/URL.js | 4 +--- static/js/pandora/account.js | 16 ++++++++-------- static/js/pandora/helpDialog.js | 2 +- static/js/pandora/logsDialog.js | 3 --- 6 files changed, 14 insertions(+), 17 deletions(-) diff --git a/pandora/itemlist/models.py b/pandora/itemlist/models.py index 5db257018..64dd6502b 100644 --- a/pandora/itemlist/models.py +++ b/pandora/itemlist/models.py @@ -34,8 +34,8 @@ class List(models.Model): icon = models.ImageField(default=None, blank=True, upload_to=lambda i, x: i.path("icon.jpg")) - view = models.TextField(default=settings.CONFIG['user']['ui']['listView']) - sort = TupleField(default=settings.CONFIG['user']['ui']['listSort'], editable=False) + view = models.TextField(default=lambda: settings.CONFIG['user']['ui']['listView']) + sort = TupleField(default=lambda: settings.CONFIG['user']['ui']['listSort'], editable=False) poster_frames = TupleField(default=[], editable=False) diff --git a/pandora/urls.py b/pandora/urls.py index 6bb4da04a..e602c5710 100644 --- a/pandora/urls.py +++ b/pandora/urls.py @@ -11,6 +11,8 @@ from django.conf import settings from django.contrib import admin admin.autodiscover() +import monkey_patch.models + from api import actions actions.autodiscover() diff --git a/static/js/pandora/URL.js b/static/js/pandora/URL.js index 2b8fc3cd6..61d2fe244 100644 --- a/static/js/pandora/URL.js +++ b/static/js/pandora/URL.js @@ -134,9 +134,7 @@ pandora.URL = (function() { ) { pandora.$ui.siteDialog = pandora.ui.siteDialog(state.page).open(); } else if (state.page == 'help') { - (pandora.$ui.helpDialog || ( - pandora.$ui.helpDialog = pandora.ui.helpDialog() - )).open(); + pandora.$ui.helpDialog = pandora.ui.helpDialog().open(); } else if (['signup', 'signin'].indexOf(state.page) > -1) { if (pandora.user.level == 'guest') { pandora.$ui.accountDialog = pandora.ui.accountDialog(state.page).open(); diff --git a/static/js/pandora/account.js b/static/js/pandora/account.js index f5ba4d404..96404988d 100644 --- a/static/js/pandora/account.js +++ b/static/js/pandora/account.js @@ -54,7 +54,7 @@ pandora.ui.accountDialogOptions = function(action, value) { id: 'cancel' + Ox.toTitleCase(action), title: 'Cancel' }).bindEvent('click', function() { - pandora.$ui.accountDialog.close(); + pandora.$ui.accountDialog.close().remove(); pandora.URL.update(); }); } else if (type == 'submit') { @@ -140,7 +140,7 @@ pandora.ui.accountForm = function(action, value) { if (action == 'signin') { pandora.api.signin(data, function(result) { if (!result.data.errors) { - pandora.$ui.accountDialog.close(); + pandora.$ui.accountDialog.close().remove(); pandora.signin(result.data); } else { pandora.$ui.accountDialog.enableButtons(); @@ -150,7 +150,7 @@ pandora.ui.accountForm = function(action, value) { } else if (action == 'signup') { pandora.api.signup(data, function(result) { if (!result.data.errors) { - pandora.$ui.accountDialog.close(); + pandora.$ui.accountDialog.close().remove(); pandora.signin(result.data); pandora.ui.accountWelcomeDialog().open(); } else { @@ -174,7 +174,7 @@ pandora.ui.accountForm = function(action, value) { } else if (action == 'resetAndSignin') { pandora.api.resetPassword(data, function(result) { if (!result.data.errors) { - pandora.$ui.accountDialog.close(); + pandora.$ui.accountDialog.close().remove(); pandora.signin(result.data); } else { pandora.$ui.accountDialog.enableButtons(); @@ -320,14 +320,14 @@ pandora.ui.accountSignoutDialog = function() { id: 'cancel', title: 'Cancel' }).bindEvent('click', function() { - that.close(); + that.close().remove(); pandora.URL.update(); }), Ox.Button({ id: 'signout', title: 'Sign Out' }).bindEvent('click', function() { - that.close(); + that.close().remove(); pandora.api.signout({}, function(result) { pandora.signout(result.data); }); @@ -360,7 +360,7 @@ pandora.ui.accountWelcomeDialog = function() { id: 'preferences', title: 'Preferences...' }).bindEvent('click', function() { - that.close(); + that.close().remove(); pandora.$ui.preferencesDialog = pandora.ui.preferencesDialog().open(); }), {}, @@ -368,7 +368,7 @@ pandora.ui.accountWelcomeDialog = function() { id: 'close', title: 'Close' }).bindEvent('click', function() { - that.close(); + that.close().remove(); }) ], content: Ox.Element() diff --git a/static/js/pandora/helpDialog.js b/static/js/pandora/helpDialog.js index 9b853f42b..2864e0807 100644 --- a/static/js/pandora/helpDialog.js +++ b/static/js/pandora/helpDialog.js @@ -8,7 +8,7 @@ pandora.ui.helpDialog = function() { title: 'Close' }).bindEvent({ click: function() { - that.close(); + that.close().remove(); //fixme: this should be using URL.push / UI.set //but that currenlty causes a reload history.pushState({}, '', '/'); diff --git a/static/js/pandora/logsDialog.js b/static/js/pandora/logsDialog.js index 3933a9ca3..a510164e4 100644 --- a/static/js/pandora/logsDialog.js +++ b/static/js/pandora/logsDialog.js @@ -86,9 +86,6 @@ pandora.ui.logsDialog = function() { { id: 'text', title: 'Text', - tooltip: function(data) { - return $('').append($('
').append(data.text));
-                        },
                         visible: true,
                         width: 640
                     },