fix a url controller bug regarding loading the page with both item and find

This commit is contained in:
rolux 2011-10-13 13:39:56 +00:00
parent 8b68a36e73
commit e3fb12441d

View file

@ -34,21 +34,24 @@ pandora.UI = (function() {
Ox.print('UI SET', args) Ox.print('UI SET', args)
self.previousUI = Ox.clone(pandora.user.ui, true); self.previousUI = Ox.clone(pandora.user.ui, true);
Ox.forEach(args, function(val, key) { Ox.forEach(args, function(val, key) {
if (key == 'find' && !Ox.isEqual(val, pandora.user.ui.find)) { if (key == 'find') {
// the challenge here is that find may change list, // the challenge here is that find may change list,
// and list may then change listSort and listView, // and list may then change listSort and listView,
// which we don't want to trigger, since find triggers // which we don't want to trigger, since find triggers
var list = pandora.getListsState(val); var list = pandora.getListsState(val);
add['item'] = '';
pandora.user.ui._list = list; pandora.user.ui._list = list;
pandora.user.ui._groupsState = pandora.getGroupsState(val); pandora.user.ui._groupsState = pandora.getGroupsState(val);
pandora.user.ui._findState = pandora.getFindState(val); pandora.user.ui._findState = pandora.getFindState(val);
if (!Ox.isEqual(val, pandora.user.ui.find)) {
if (pandora.$ui.appPanel) {
// if find has changed and we're not on page load,
// switch from item view to list view
add['item'] = '';
}
if (!pandora.user.ui.lists[list]) { if (!pandora.user.ui.lists[list]) {
add['lists.' + that.encode(list)] = {}; add['lists.' + that.encode(list)] = {};
} }
// fixme: if we did this on page load, if (list != self.previousUI._list) {
// find would get set to advanced
if (pandora.$ui.appPanel && list != self.previousUI._list) {
Ox.forEach(listSettings, function(listSetting, setting) { Ox.forEach(listSettings, function(listSetting, setting) {
if (!pandora.user.ui.lists[list]) { if (!pandora.user.ui.lists[list]) {
// add default list setting and copy to settings // add default list setting and copy to settings
@ -60,7 +63,9 @@ pandora.UI = (function() {
} }
}); });
} }
} else if (Object.keys(listSettings).indexOf(key) > -1) { }
}
else if (Object.keys(listSettings).indexOf(key) > -1) {
// copy setting to list setting // copy setting to list setting
add['lists.' + that.encode(pandora.user.ui._list || '') + '.' + listSettings[key]] = val; add['lists.' + that.encode(pandora.user.ui._list || '') + '.' + listSettings[key]] = val;
} else if (key == 'item' && val) { } else if (key == 'item' && val) {