url controller fixes

This commit is contained in:
rolux 2011-09-17 09:15:24 +00:00
parent deb208dcba
commit 9e2f0ad404

View file

@ -10,7 +10,6 @@ pandora.URL = (function() {
if (pandora.user.ui.showHome) { if (pandora.user.ui.showHome) {
pandora.$ui.home = pandora.ui.home().showScreen(); pandora.$ui.home = pandora.ui.home().showScreen();
} }
pandora.Query.updateGroups();
} else if (/^\?url=/.test(search)) { } else if (/^\?url=/.test(search)) {
document.location = decodeURIComponent(search.substr(5)); document.location = decodeURIComponent(search.substr(5));
} else { } else {
@ -23,21 +22,17 @@ pandora.URL = (function() {
}, },
'^home$': function(pathname, search) { '^home$': function(pathname, search) {
pandora.$ui.home = pandora.ui.home().showScreen(); pandora.$ui.home = pandora.ui.home().showScreen();
pandora.Query.updateGroups();
}, },
'^(items|edits|texts)$': function(pathname, search) { '^(items|edits|texts)$': function(pathname, search) {
pandora.UI.set({ pandora.UI.set({
section: pathname section: pathname
}); });
pandora.Query.updateGroups();
}, },
'^(about|contact|faq|news|software|terms|tour)$': function(pathname, search) { '^(about|contact|faq|news|software|terms|tour)$': function(pathname, search) {
pandora.$ui.siteDialog = pandora.ui.siteDialog(pathname).open(); pandora.$ui.siteDialog = pandora.ui.siteDialog(pathname).open();
pandora.Query.updateGroups();
}, },
'^help$': function(pathname, search) { '^help$': function(pathname, search) {
pandora.$ui.helpDialog = pandora.ui.helpDialog().open(); pandora.$ui.helpDialog = pandora.ui.helpDialog().open();
pandora.Query.updateGroups();
}, },
'^(signin|signout|signup)$': function(pathname, search) { '^(signin|signout|signup)$': function(pathname, search) {
if ((pathname == 'signout') == (pandora.user.level != 'guest')) { if ((pathname == 'signout') == (pandora.user.level != 'guest')) {
@ -47,11 +42,9 @@ pandora.URL = (function() {
: pandora.ui.accountSignoutDialog() : pandora.ui.accountSignoutDialog()
).open(); ).open();
} }
pandora.Query.updateGroups();
}, },
'^preferences$': function(pathname, search) { '^preferences$': function(pathname, search) {
pandora.$ui.preferencesDialog = pandora.ui.preferencesDialog().open(); pandora.$ui.preferencesDialog = pandora.ui.preferencesDialog().open();
pandora.Query.updateGroups();
}, },
'^(calendar|calendars|clip|clips|flow|grid|list|map|maps|timelines)$': function(pathname, search) { '^(calendar|calendars|clip|clips|flow|grid|list|map|maps|timelines)$': function(pathname, search) {
pandora.UI.set({ pandora.UI.set({
@ -59,7 +52,6 @@ pandora.URL = (function() {
item: '' item: ''
}); });
pandora.UI.set(['lists', pandora.user.ui.list, 'listView'].join('|'), pathname); pandora.UI.set(['lists', pandora.user.ui.list, 'listView'].join('|'), pathname);
pandora.Query.updateGroups();
pandora.Query.fromString(search); pandora.Query.fromString(search);
}, },
'^[0-9A-Z]': function(pathname, search) { '^[0-9A-Z]': function(pathname, search) {
@ -122,6 +114,10 @@ pandora.URL = (function() {
}, },
'.*': function(pathname, search) { '.*': function(pathname, search) {
var query = search || 'find=' + pathname; var query = search || 'find=' + pathname;
pandora.UI.set({
section: 'items',
item: ''
});
pandora.Query.fromString(query); pandora.Query.fromString(query);
pandora.URL.replace('?' + query); pandora.URL.replace('?' + query);
} }
@ -144,6 +140,7 @@ 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)) {