From 5351cf498dbc3c93ca9b8bccbf608cdafcfb854a Mon Sep 17 00:00:00 2001 From: rolux Date: Mon, 11 Feb 2013 16:45:06 +0530 Subject: [PATCH] add pandora.updateItemContext() --- static/js/pandora/utils.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/static/js/pandora/utils.js b/static/js/pandora/utils.js index 12489757..450a2c02 100644 --- a/static/js/pandora/utils.js +++ b/static/js/pandora/utils.js @@ -1244,6 +1244,23 @@ pandora.unloadWindow = function() { */ }; +pandora.updateItemContext = function() { + if (!Ox.isEqual(pandora.user.ui.find, pandora.site.user.ui.find)) { + Ox.Request.clearCache('find'); + pandora.api.find({ + query: pandora.user.ui.find, + positions: [pandora.user.ui.item], + sort: pandora.user.ui.sort + }, function(result) { + if (result.data.positions[pandora.user.ui.item] === void 0) { + pandora.stayInItemView = true; + pandora.UI.set({find: pandora.site.user.ui.find}); + pandora.$ui.contentPanel.replaceElement(0, pandora.$ui.browser = pandora.ui.browser()); + } + }); + } +}; + (function() { // Note: getFindState has to run after getListState and getFilterState