fix a bug where on the toolbar, sort select and order button would not be hidden or shown correctly

This commit is contained in:
rolux 2011-10-31 13:27:49 +00:00
parent 8c77c5c5b1
commit 234c5fc760

View file

@ -43,13 +43,16 @@ pandora.ui.toolbar = function() {
that.bindEvent({ that.bindEvent({
pandora_listview: function(data) { pandora_listview: function(data) {
var isNavigationView = ['map', 'calendar'].indexOf(data.value) > -1, var isNavigationView = ['map', 'calendar'].indexOf(data.value) > -1,
wasNavigationView = ['map', 'calendar'].indexOf(data.previousValue) > -1; wasNavigationView = ['map', 'calendar'].indexOf(data.previousValue) > -1,
action = isNavigationView ? 'hide' : 'show';
Ox.print('IS/WAS', isNavigationView, wasNavigationView);
if (isNavigationView != wasNavigationView) { if (isNavigationView != wasNavigationView) {
pandora.$ui.sortSelect[isNavigationView ? 'hide' : 'show'](); pandora.$ui.sortSelect[action]();
pandora.$ui.orderButton[action]();
} }
if (pandora.isClipView() != pandora.isClipView(data.previousValue)) { if (pandora.isClipView() != pandora.isClipView(data.previousValue)) {
pandora.$ui.sortSelect.replaceWith( pandora.$ui.sortSelect.replaceWith(
pandora.$ui.sortSelect = pandora.ui.sortSelect() pandora.$ui.sortSelect = pandora.ui.sortSelect()[action]()
); );
} }
} }