fixing more list selection bugs

This commit is contained in:
rolux 2011-09-17 13:04:10 +00:00
parent 823a14ebda
commit a8b0ae3da2
4 changed files with 25 additions and 10 deletions

View file

@ -8,14 +8,18 @@ pandora.URL = (function() {
'^$': function(pathname, search) { '^$': function(pathname, search) {
if (/^\?url=/.test(search)) { if (/^\?url=/.test(search)) {
document.location = decodeURIComponent(search.substr(5)); document.location = decodeURIComponent(search.substr(5));
} else {
if (!search && pandora.user.ui.showHome) {
pandora.$ui.home = pandora.ui.home().showScreen();
pandora.user.ui.list && pandora.Query.fromString(
'find=list:' + pandora.user.ui.list
);
} else { } else {
pandora.Query.fromString(search); pandora.Query.fromString(search);
pandora.UI.set({ pandora.UI.set({
section: 'items', section: 'items',
item: '' item: ''
}); });
if (!search && pandora.user.ui.showHome) {
pandora.$ui.home = pandora.ui.home().showScreen();
} }
} }
}, },
@ -139,7 +143,6 @@ pandora.URL = (function() {
+ document.location.search + document.location.search
+ document.location.hash; + document.location.hash;
*/ */
pandora.Query.updateGroups();
Ox.forEach(regexps, function(fn, re) { Ox.forEach(regexps, function(fn, re) {
re = new RegExp(re); re = new RegExp(re);
if (re.test(pathname)) { if (re.test(pathname)) {
@ -148,6 +151,7 @@ pandora.URL = (function() {
return false; return false;
} }
}); });
pandora.Query.updateGroups();
pandora.user.ui.showHome = false; pandora.user.ui.showHome = false;
}, },

View file

@ -181,10 +181,10 @@ pandora.ui.folderBrowserList = function(id) {
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.UI.set({list: data.ids[0]}); //pandora.UI.set({list: data.ids[0]});
pandora.URL.set('?find=list:' + data.ids[0]); pandora.URL.set('?find=list:' + data.ids[0]);
} else { } else {
pandora.UI.set({list: ''}); //pandora.UI.set({list: ''});
pandora.URL.set(''); pandora.URL.set('');
} }
} }

View file

@ -361,6 +361,7 @@ pandora.ui.folderList = function(id) {
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.UI.set({list: data.ids[0]});
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: ''});

View file

@ -2,6 +2,8 @@
pandora.ui.home = function() { pandora.ui.home = function() {
// fixme: if a list was selected previously, it will steal focus from the input element
var that = $('<div>') var that = $('<div>')
.attr({id: 'home'}) .attr({id: 'home'})
.css({ .css({
@ -85,8 +87,11 @@ pandora.ui.home = function() {
}) })
.bindEvent({ .bindEvent({
submit: function(data) { submit: function(data) {
data.value && pandora.URL.set('/?find=' + data.value); if (data.value) {
that.fadeOutScreen(); $findButton.triggerEvent('click');
} else {
$browseButton.triggerEvent('click');
}
} }
}) })
.appendTo(that), .appendTo(that),
@ -105,6 +110,11 @@ pandora.ui.home = function() {
}) })
.bindEvent({ .bindEvent({
click: function() { click: function() {
if (pandora.user.ui.list) {
Ox.forEach(pandora.$ui.folderList, function($list) {
$list.options({selected: []});
});
}
pandora.URL.set('/?find=' + $findInput.value()); pandora.URL.set('/?find=' + $findInput.value());
that.fadeOutScreen(); that.fadeOutScreen();
} }