forked from 0x2620/pandora
fix a url controller bug regarding loading the page with both item and find
This commit is contained in:
parent
8b68a36e73
commit
e3fb12441d
1 changed files with 24 additions and 19 deletions
|
@ -34,33 +34,38 @@ 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 (!pandora.user.ui.lists[list]) {
|
if (!Ox.isEqual(val, pandora.user.ui.find)) {
|
||||||
add['lists.' + that.encode(list)] = {};
|
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]) {
|
||||||
|
add['lists.' + that.encode(list)] = {};
|
||||||
|
}
|
||||||
|
if (list != self.previousUI._list) {
|
||||||
|
Ox.forEach(listSettings, function(listSetting, setting) {
|
||||||
|
if (!pandora.user.ui.lists[list]) {
|
||||||
|
// add default list setting and copy to settings
|
||||||
|
add['lists.' + that.encode(list)][listSetting] = pandora.site.user.ui[setting];
|
||||||
|
add[setting] = pandora.site.user.ui[setting];
|
||||||
|
} else {
|
||||||
|
// copy lists setting to settings
|
||||||
|
add[setting] = pandora.user.ui.lists[list][listSetting]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// fixme: if we did this on page load,
|
}
|
||||||
// find would get set to advanced
|
else if (Object.keys(listSettings).indexOf(key) > -1) {
|
||||||
if (pandora.$ui.appPanel && list != self.previousUI._list) {
|
|
||||||
Ox.forEach(listSettings, function(listSetting, setting) {
|
|
||||||
if (!pandora.user.ui.lists[list]) {
|
|
||||||
// add default list setting and copy to settings
|
|
||||||
add['lists.' + that.encode(list)][listSetting] = pandora.site.user.ui[setting];
|
|
||||||
add[setting] = pandora.site.user.ui[setting];
|
|
||||||
} else {
|
|
||||||
// copy lists setting to settings
|
|
||||||
add[setting] = pandora.user.ui.lists[list][listSetting]
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} 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) {
|
||||||
|
|
Loading…
Reference in a new issue