remove dialogs with state

This commit is contained in:
rolux 2011-11-04 18:10:48 +00:00
parent 50e5c6b760
commit d3225ad4af
6 changed files with 14 additions and 17 deletions

View file

@ -34,8 +34,8 @@ class List(models.Model):
icon = models.ImageField(default=None, blank=True, icon = models.ImageField(default=None, blank=True,
upload_to=lambda i, x: i.path("icon.jpg")) upload_to=lambda i, x: i.path("icon.jpg"))
view = models.TextField(default=settings.CONFIG['user']['ui']['listView']) view = models.TextField(default=lambda: settings.CONFIG['user']['ui']['listView'])
sort = TupleField(default=settings.CONFIG['user']['ui']['listSort'], editable=False) sort = TupleField(default=lambda: settings.CONFIG['user']['ui']['listSort'], editable=False)
poster_frames = TupleField(default=[], editable=False) poster_frames = TupleField(default=[], editable=False)

View file

@ -11,6 +11,8 @@ from django.conf import settings
from django.contrib import admin from django.contrib import admin
admin.autodiscover() admin.autodiscover()
import monkey_patch.models
from api import actions from api import actions
actions.autodiscover() actions.autodiscover()

View file

@ -134,9 +134,7 @@ pandora.URL = (function() {
) { ) {
pandora.$ui.siteDialog = pandora.ui.siteDialog(state.page).open(); pandora.$ui.siteDialog = pandora.ui.siteDialog(state.page).open();
} else if (state.page == 'help') { } 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) { } else if (['signup', 'signin'].indexOf(state.page) > -1) {
if (pandora.user.level == 'guest') { if (pandora.user.level == 'guest') {
pandora.$ui.accountDialog = pandora.ui.accountDialog(state.page).open(); pandora.$ui.accountDialog = pandora.ui.accountDialog(state.page).open();

View file

@ -54,7 +54,7 @@ pandora.ui.accountDialogOptions = function(action, value) {
id: 'cancel' + Ox.toTitleCase(action), id: 'cancel' + Ox.toTitleCase(action),
title: 'Cancel' title: 'Cancel'
}).bindEvent('click', function() { }).bindEvent('click', function() {
pandora.$ui.accountDialog.close(); pandora.$ui.accountDialog.close().remove();
pandora.URL.update(); pandora.URL.update();
}); });
} else if (type == 'submit') { } else if (type == 'submit') {
@ -140,7 +140,7 @@ pandora.ui.accountForm = function(action, value) {
if (action == 'signin') { if (action == 'signin') {
pandora.api.signin(data, function(result) { pandora.api.signin(data, function(result) {
if (!result.data.errors) { if (!result.data.errors) {
pandora.$ui.accountDialog.close(); pandora.$ui.accountDialog.close().remove();
pandora.signin(result.data); pandora.signin(result.data);
} else { } else {
pandora.$ui.accountDialog.enableButtons(); pandora.$ui.accountDialog.enableButtons();
@ -150,7 +150,7 @@ pandora.ui.accountForm = function(action, value) {
} else if (action == 'signup') { } else if (action == 'signup') {
pandora.api.signup(data, function(result) { pandora.api.signup(data, function(result) {
if (!result.data.errors) { if (!result.data.errors) {
pandora.$ui.accountDialog.close(); pandora.$ui.accountDialog.close().remove();
pandora.signin(result.data); pandora.signin(result.data);
pandora.ui.accountWelcomeDialog().open(); pandora.ui.accountWelcomeDialog().open();
} else { } else {
@ -174,7 +174,7 @@ pandora.ui.accountForm = function(action, value) {
} else if (action == 'resetAndSignin') { } else if (action == 'resetAndSignin') {
pandora.api.resetPassword(data, function(result) { pandora.api.resetPassword(data, function(result) {
if (!result.data.errors) { if (!result.data.errors) {
pandora.$ui.accountDialog.close(); pandora.$ui.accountDialog.close().remove();
pandora.signin(result.data); pandora.signin(result.data);
} else { } else {
pandora.$ui.accountDialog.enableButtons(); pandora.$ui.accountDialog.enableButtons();
@ -320,14 +320,14 @@ pandora.ui.accountSignoutDialog = function() {
id: 'cancel', id: 'cancel',
title: 'Cancel' title: 'Cancel'
}).bindEvent('click', function() { }).bindEvent('click', function() {
that.close(); that.close().remove();
pandora.URL.update(); pandora.URL.update();
}), }),
Ox.Button({ Ox.Button({
id: 'signout', id: 'signout',
title: 'Sign Out' title: 'Sign Out'
}).bindEvent('click', function() { }).bindEvent('click', function() {
that.close(); that.close().remove();
pandora.api.signout({}, function(result) { pandora.api.signout({}, function(result) {
pandora.signout(result.data); pandora.signout(result.data);
}); });
@ -360,7 +360,7 @@ pandora.ui.accountWelcomeDialog = function() {
id: 'preferences', id: 'preferences',
title: 'Preferences...' title: 'Preferences...'
}).bindEvent('click', function() { }).bindEvent('click', function() {
that.close(); that.close().remove();
pandora.$ui.preferencesDialog = pandora.ui.preferencesDialog().open(); pandora.$ui.preferencesDialog = pandora.ui.preferencesDialog().open();
}), }),
{}, {},
@ -368,7 +368,7 @@ pandora.ui.accountWelcomeDialog = function() {
id: 'close', id: 'close',
title: 'Close' title: 'Close'
}).bindEvent('click', function() { }).bindEvent('click', function() {
that.close(); that.close().remove();
}) })
], ],
content: Ox.Element() content: Ox.Element()

View file

@ -8,7 +8,7 @@ pandora.ui.helpDialog = function() {
title: 'Close' title: 'Close'
}).bindEvent({ }).bindEvent({
click: function() { click: function() {
that.close(); that.close().remove();
//fixme: this should be using URL.push / UI.set //fixme: this should be using URL.push / UI.set
//but that currenlty causes a reload //but that currenlty causes a reload
history.pushState({}, '', '/'); history.pushState({}, '', '/');

View file

@ -86,9 +86,6 @@ pandora.ui.logsDialog = function() {
{ {
id: 'text', id: 'text',
title: 'Text', title: 'Text',
tooltip: function(data) {
return $('<code>').append($('<pre>').append(data.text));
},
visible: true, visible: true,
width: 640 width: 640
}, },