From 41f6ca478c94acc4c06e4981b662367162e0e251 Mon Sep 17 00:00:00 2001 From: rolux Date: Sat, 8 Oct 2011 15:16:22 +0000 Subject: [PATCH] fix errors when signing in or out --- static/js/pandora/ui/account.js | 71 +++++++++++++++++---------------- static/js/pandora/utils.js | 10 +++-- 2 files changed, 43 insertions(+), 38 deletions(-) diff --git a/static/js/pandora/ui/account.js b/static/js/pandora/ui/account.js index d71b9ab1b..c995c80bc 100644 --- a/static/js/pandora/ui/account.js +++ b/static/js/pandora/ui/account.js @@ -52,6 +52,7 @@ pandora.ui.accountDialogOptions = function(action, value) { title: 'Cancel' }).bindEvent('click', function() { pandora.$ui.accountDialog.close(); + pandora.URL.update(); }); } else if (type == 'submit') { return Ox.Button({ @@ -305,41 +306,41 @@ pandora.ui.accountForm = function(action, value) { pandora.ui.accountSignoutDialog = function() { var that = Ox.Dialog({ - buttons: [ - Ox.Button({ - id: 'cancel', - title: 'Cancel' - }).bindEvent('click', function() { - that.close(); - pandora.$ui.mainMenu.getItem('signinsignout').toggleTitle(); - }), - Ox.Button({ - id: 'signout', - title: 'Sign Out' - }).bindEvent('click', function() { - that.close(); - pandora.api.signout({}, function(result) { - pandora.signout(result.data); - }); - }) - ], - content: Ox.Element() - .append( - $('') - .attr({src: '/static/png/icon64.png'}) - .css({position: 'absolute', left: '16px', top: '16px', width: '64px', height: '64px'}) - ) - .append( - $('
') - .css({position: 'absolute', left: '96px', top: '16px', width: '192px'}) - .html('Are you sure you want to sign out?') - ), - fixedSize: true, - height: 128, - keys: {enter: 'signout', escape: 'cancel'}, - title: 'Sign Out', - width: 304 - }); + buttons: [ + Ox.Button({ + id: 'cancel', + title: 'Cancel' + }).bindEvent('click', function() { + that.close(); + pandora.URL.update(); + }), + Ox.Button({ + id: 'signout', + title: 'Sign Out' + }).bindEvent('click', function() { + that.close(); + pandora.api.signout({}, function(result) { + pandora.signout(result.data); + }); + }) + ], + content: Ox.Element() + .append( + $('') + .attr({src: '/static/png/icon64.png'}) + .css({position: 'absolute', left: '16px', top: '16px', width: '64px', height: '64px'}) + ) + .append( + $('
') + .css({position: 'absolute', left: '96px', top: '16px', width: '192px'}) + .html('Are you sure you want to sign out?') + ), + fixedSize: true, + height: 128, + keys: {enter: 'signout', escape: 'cancel'}, + title: 'Sign Out', + width: 304 + }); return that; }; diff --git a/static/js/pandora/utils.js b/static/js/pandora/utils.js index 89b655b98..951069eef 100644 --- a/static/js/pandora/utils.js +++ b/static/js/pandora/utils.js @@ -632,7 +632,9 @@ pandora.isClipView = function(view, item) { pandora.signin = function(data) { pandora.user = data.user; - pandora.Query.updateGroups(); + pandora.user.ui._list = pandora.getListsState(pandora.user.ui.find); + pandora.user.ui._groupsState = pandora.getGroupsState(pandora.user.ui.find); + pandora.user.ui._findState = pandora.getFindState(pandora.user.ui.find); Ox.Theme(pandora.user.ui.theme); pandora.UI.set({find: pandora.user.ui.find}) pandora.$ui.appPanel.reload(); @@ -640,7 +642,9 @@ pandora.signin = function(data) { pandora.signout = function(data) { pandora.user = data.user; - pandora.Query.updateGroups(); + pandora.user.ui._list = pandora.getListsState(pandora.user.ui.find); + pandora.user.ui._groupsState = pandora.getGroupsState(pandora.user.ui.find); + pandora.user.ui._findState = pandora.getFindState(pandora.user.ui.find); Ox.Theme(pandora.site.user.ui.theme); pandora.UI.set({find: pandora.user.ui.find}) pandora.$ui.appPanel.reload(); @@ -738,7 +742,7 @@ pandora.selectList = function() { (function() { - // Note: getFindState has to run after getListState and getGroupsState + // Note: getFindState has to run after getListsState and getGroupsState function everyCondition(conditions, key, operator) { // If every condition has the given key and operator