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._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;

View file

@ -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 {

View file

@ -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) {

View file

@ -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();
}
})