some improvements to url controller

This commit is contained in:
rolux 2011-10-08 13:09:16 +00:00
parent 7ac199a879
commit 63f6ed6d49
4 changed files with 33 additions and 28 deletions

View file

@ -43,7 +43,8 @@ pandora.UI = (function() {
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 (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]) { if (!pandora.user.ui.lists[list]) {
add['lists.' + that.encode(list)] = {}; add['lists.' + that.encode(list)] = {};
} }
@ -98,7 +99,7 @@ pandora.UI = (function() {
if (!isAdd) { if (!isAdd) {
trigger[key] = val; trigger[key] = val;
} }
}// else { alert(keys[0] + ' equal\n\n' + JSON.stringify([ui[keys[0]], val])); } }
}); });
}); });
Ox.len(set) && pandora.api.setUI(set); Ox.len(set) && pandora.api.setUI(set);
@ -110,19 +111,10 @@ pandora.UI = (function() {
}); });
}); });
}); });
/* Ox.print('isBooting?', !pandora.$ui.appPanel, Object.keys(args), pandora.user.ui.listView);
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));
pandora.URL.update(Object.keys( pandora.URL.update(Object.keys(
!pandora.$ui.appPanel ? args : trigger !pandora.$ui.appPanel ? args : trigger
)); ));
}; };
return that; return that;

View file

@ -21,9 +21,11 @@ pandora.URL = (function() {
if (!keys || keys.indexOf('listView') > -1 || keys.indexOf('itemView') > -1) { if (!keys || keys.indexOf('listView') > -1 || keys.indexOf('itemView') > -1) {
if (!pandora.user.ui.item) { if (!pandora.user.ui.item) {
state.view = pandora.user.ui.listView; state.view = pandora.user.ui.listView;
state.sort = pandora.user.ui.listSort;
} else { } else {
state.item = pandora.user.ui.item; state.item = pandora.user.ui.item;
state.view = pandora.user.ui.itemView; state.view = pandora.user.ui.itemView;
state.sort = pandora.user.ui.itemSort;
} }
} }
if (!keys || keys.indexOf('mapSelection') > -1) { if (!keys || keys.indexOf('mapSelection') > -1) {
@ -78,6 +80,17 @@ pandora.URL = (function() {
if (!state.item) { if (!state.item) {
state.find = pandora.user.ui.find; 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) Ox.print('STATE .................... ->', state)
return state; return state;
} }
@ -367,6 +380,12 @@ pandora.URL = (function() {
Ox.print('update.........', keys) Ox.print('update.........', keys)
// this gets called from pandora.UI // this gets called from pandora.UI
var action; 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) { if (self.isPopState) {
self.isPopState = false; self.isPopState = false;
} else { } else {

View file

@ -102,7 +102,7 @@ pandora.ui.findElement = function() {
} }
pandora.UI.set('find', { pandora.UI.set('find', {
conditions: conditions, conditions: conditions,
operator: '' operator: '&'
}); });
} }
} }
@ -113,14 +113,6 @@ pandora.ui.findElement = function() {
.css({ .css({
float: 'right', float: 'right',
margin: '4px' 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() { function autocompleteFunction() {
return pandora.user.ui.find.conditions.length ? function(value, callback) { return pandora.user.ui.find.conditions.length ? function(value, callback) {

View file

@ -59,8 +59,7 @@ pandora.ui.home = function() {
}) })
.bind({ .bind({
click: function() { click: function() {
pandora.URL.pop(); $browseButton.triggerEvent('click');
that.fadeOutScreen();
} }
}) })
.appendTo(that), .appendTo(that),
@ -105,18 +104,21 @@ pandora.ui.home = function() {
}) })
.bindEvent({ .bindEvent({
click: function() { click: function() {
var folder = pandora.getListData().folder; var folder = pandora.getListData().folder,
value = $findInput.value();
folder && pandora.$ui.folderList[folder].options({selected: []}); folder && pandora.$ui.folderList[folder].options({selected: []});
//pandora.URL.push('/=' + $findInput.value()); pandora.$ui.findInput.options({
value: value
});
that.fadeOutScreen();
pandora.UI.set('find', { pandora.UI.set('find', {
conditions: [{ conditions: [{
key: '*', key: '*',
value: $findInput.value(), value: value,
operator: '=' operator: '='
}], }],
operator: '&' operator: '&'
}); });
that.fadeOutScreen();
} }
}) })
.appendTo(that), .appendTo(that),
@ -135,7 +137,7 @@ pandora.ui.home = function() {
}) })
.bindEvent({ .bindEvent({
click: function() { click: function() {
//pandora.URL.push(); pandora.URL.update();
that.fadeOutScreen(); that.fadeOutScreen();
} }
}) })