diff --git a/static/js/pandora/UI.js b/static/js/pandora/UI.js index 7c127767..47d00c3a 100644 --- a/static/js/pandora/UI.js +++ b/static/js/pandora/UI.js @@ -43,7 +43,8 @@ pandora.UI = (function() { pandora.user.ui._list = list; pandora.user.ui._groupsState = pandora.getGroupsState(val); pandora.user.ui._findState = pandora.getFindState(val); - if (list != self.previousUI._list) { + // make sure we don't do this on page load + if (pandora.$ui.appPanel && list != self.previousUI._list) { if (!pandora.user.ui.lists[list]) { add['lists.' + that.encode(list)] = {}; } @@ -98,7 +99,7 @@ pandora.UI = (function() { if (!isAdd) { trigger[key] = val; } - }// else { alert(keys[0] + ' equal\n\n' + JSON.stringify([ui[keys[0]], val])); } + } }); }); Ox.len(set) && pandora.api.setUI(set); @@ -110,19 +111,10 @@ pandora.UI = (function() { }); }); }); - /* - if (!pandora.$ui.appPanel) { - pandora.URL.replace(); - } else if (Ox.len(trigger)) { - pandora.URL.push(); - } - */ - // pandora.URL.update(Object.keys(trigger)); - Ox.print('isBooting?', !pandora.$ui.appPanel, Object.keys(args)); + Ox.print('isBooting?', !pandora.$ui.appPanel, Object.keys(args), pandora.user.ui.listView); pandora.URL.update(Object.keys( !pandora.$ui.appPanel ? args : trigger )); - }; return that; diff --git a/static/js/pandora/URL.js b/static/js/pandora/URL.js index a6965d44..f7043b40 100644 --- a/static/js/pandora/URL.js +++ b/static/js/pandora/URL.js @@ -21,9 +21,11 @@ pandora.URL = (function() { if (!keys || keys.indexOf('listView') > -1 || keys.indexOf('itemView') > -1) { if (!pandora.user.ui.item) { state.view = pandora.user.ui.listView; + state.sort = pandora.user.ui.listSort; } else { state.item = pandora.user.ui.item; state.view = pandora.user.ui.itemView; + state.sort = pandora.user.ui.itemSort; } } if (!keys || keys.indexOf('mapSelection') > -1) { @@ -78,6 +80,17 @@ pandora.URL = (function() { if (!state.item) { state.find = pandora.user.ui.find; } + if (!keys || keys.indexOf('find') > -1) { + if (!pandora.user.ui.item) { + state.view = pandora.user.ui.listView; + state.sort = pandora.user.ui.listSort; + } else { + state.item = pandora.user.ui.item; + state.view = pandora.user.ui.itemView; + state.sort = pandora.user.ui.itemSort; + } + state.find = pandora.user.ui.find + } Ox.print('STATE .................... ->', state) return state; } @@ -367,6 +380,12 @@ pandora.URL = (function() { Ox.print('update.........', keys) // this gets called from pandora.UI var action; + if (!keys) { + // may get called from home screen too + keys = !pandora.user.ui.item + ? ['listView', 'listSort', 'find'] + : ['item', 'itemView', 'itemSort']; + } if (self.isPopState) { self.isPopState = false; } else { diff --git a/static/js/pandora/ui/findElement.js b/static/js/pandora/ui/findElement.js index 8f1d5bc6..d5f1ab79 100644 --- a/static/js/pandora/ui/findElement.js +++ b/static/js/pandora/ui/findElement.js @@ -102,7 +102,7 @@ pandora.ui.findElement = function() { } pandora.UI.set('find', { conditions: conditions, - operator: '' + operator: '&' }); } } @@ -113,14 +113,6 @@ pandora.ui.findElement = function() { .css({ float: 'right', margin: '4px' - }) - .bindEvent({ - // find may be changed from the home screen - pandora_find: function(data) { - pandora.$ui.findInput.options({ - value: data.value.conditions[0].value - }); - } }); function autocompleteFunction() { return pandora.user.ui.find.conditions.length ? function(value, callback) { diff --git a/static/js/pandora/ui/home.js b/static/js/pandora/ui/home.js index ee4f1350..3ad785a6 100644 --- a/static/js/pandora/ui/home.js +++ b/static/js/pandora/ui/home.js @@ -59,8 +59,7 @@ pandora.ui.home = function() { }) .bind({ click: function() { - pandora.URL.pop(); - that.fadeOutScreen(); + $browseButton.triggerEvent('click'); } }) .appendTo(that), @@ -105,18 +104,21 @@ pandora.ui.home = function() { }) .bindEvent({ click: function() { - var folder = pandora.getListData().folder; + var folder = pandora.getListData().folder, + value = $findInput.value(); folder && pandora.$ui.folderList[folder].options({selected: []}); - //pandora.URL.push('/=' + $findInput.value()); + pandora.$ui.findInput.options({ + value: value + }); + that.fadeOutScreen(); pandora.UI.set('find', { conditions: [{ key: '*', - value: $findInput.value(), + value: value, operator: '=' }], operator: '&' }); - that.fadeOutScreen(); } }) .appendTo(that), @@ -135,7 +137,7 @@ pandora.ui.home = function() { }) .bindEvent({ click: function() { - //pandora.URL.push(); + pandora.URL.update(); that.fadeOutScreen(); } })