fixing a list selection bug

This commit is contained in:
rolux 2011-09-17 12:16:31 +00:00
parent b1aa2fe73d
commit 823a14ebda
3 changed files with 20 additions and 24 deletions

View file

@ -221,10 +221,7 @@ pandora.Query = (function() {
return { return {
fromString: function(str) { fromString: function(str) {
var data var query = Ox.unserialize(str),
query = Ox.unserialize(str),
sort = []
if ('find' in query) {
data = parseFind(query.find || ''); data = parseFind(query.find || '');
Ox.print(Ox.repeat('-', 120)); Ox.print(Ox.repeat('-', 120));
Ox.print('STATE', data); Ox.print('STATE', data);
@ -235,12 +232,9 @@ pandora.Query = (function() {
pandora.UI.set({list: data.list}); pandora.UI.set({list: data.list});
pandora.user.ui.find = data.find; pandora.user.ui.find = data.find;
pandora.user.ui.groupsData = data.groups; pandora.user.ui.groupsData = data.groups;
Ox.print("PUUGD", pandora.user.ui.groupsData);
pandora.user.ui.query = data.query; pandora.user.ui.query = data.query;
}
if ('sort' in query) { if ('sort' in query) {
sort = query.sort.split(','); pandora.UI.set('lists|' + pandora.user.ui.list + '|sort', query.sort.split(',').map(function(v) {
pandora.UI.set(['lists', pandora.user.ui.list, 'sort'].join('|'), query.sort.split(',').map(function(v) {
var hasOperator = '+-'.indexOf(v[0]) > -1, var hasOperator = '+-'.indexOf(v[0]) > -1,
key = hasOperator ? v.substr(1) : v, key = hasOperator ? v.substr(1) : v,
operator = hasOperator ? v[0]/*.replace('+', '')*/ : pandora.getSortOperator(key); operator = hasOperator ? v[0]/*.replace('+', '')*/ : pandora.getSortOperator(key);
@ -250,9 +244,11 @@ pandora.Query = (function() {
}; };
})); }));
} }
/*
if ('view' in query) { if ('view' in query) {
pandora.UI.set(['lists', pandora.user.ui.list, 'listView'].join('|'), query.view); pandora.UI.set(['lists', pandora.user.ui.list, 'listView'].join('|'), query.view);
} }
*/
}, },
/* /*

View file

@ -6,11 +6,7 @@ pandora.URL = (function() {
var previousURL = '', var previousURL = '',
regexps = { regexps = {
'^$': function(pathname, search) { '^$': function(pathname, search) {
if (!search) { if (/^\?url=/.test(search)) {
if (pandora.user.ui.showHome) {
pandora.$ui.home = pandora.ui.home().showScreen();
}
} else if (/^\?url=/.test(search)) {
document.location = decodeURIComponent(search.substr(5)); document.location = decodeURIComponent(search.substr(5));
} else { } else {
pandora.Query.fromString(search); pandora.Query.fromString(search);
@ -18,6 +14,9 @@ pandora.URL = (function() {
section: 'items', section: 'items',
item: '' item: ''
}); });
if (!search && pandora.user.ui.showHome) {
pandora.$ui.home = pandora.ui.home().showScreen();
}
} }
}, },
'^home$': function(pathname, search) { '^home$': function(pathname, search) {

View file

@ -356,13 +356,14 @@ pandora.ui.folderList = function(id) {
pandora.$ui.list.triggerEvent('paste', data); pandora.$ui.list.triggerEvent('paste', data);
}, },
select: function(data) { select: function(data) {
//pandora.user.ui.item && pandora.UI.set({item: ''});
if (data.ids.length) { if (data.ids.length) {
Ox.forEach(pandora.$ui.folderList, function($list, id_) { Ox.forEach(pandora.$ui.folderList, function($list, id_) {
id != id_ && $list.options('selected', []); id != id_ && $list.options('selected', []);
}); });
pandora.URL.set('?find=' + (id == 'volumes' ? 'volume' : 'list') + ':' + data.ids[0]); pandora.URL.set('?find=' + (id == 'volumes' ? 'volume' : 'list') + ':' + data.ids[0]);
} else { } else {
pandora.UI.set({list: ''}); //pandora.UI.set({list: ''});
pandora.URL.set(''); pandora.URL.set('');
} }
}, },