From 4329922d6bdc017e6a3c51f752663faafc626de5 Mon Sep 17 00:00:00 2001 From: rolux Date: Tue, 20 Mar 2012 09:45:40 +0000 Subject: [PATCH] fix a bug with switching list view while viewing an item --- static/js/pandora/toolbar.js | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/static/js/pandora/toolbar.js b/static/js/pandora/toolbar.js index 6d3bf6695..69c540331 100644 --- a/static/js/pandora/toolbar.js +++ b/static/js/pandora/toolbar.js @@ -40,22 +40,23 @@ pandora.ui.toolbar = function() { ); that.bindEvent({ pandora_listview: function(data) { - var isNavigationView = ['map', 'calendar'].indexOf(data.value) > -1, - wasNavigationView = ['map', 'calendar'].indexOf(data.previousValue) > -1, - action = isNavigationView ? 'hide' : 'show'; - Ox.Log('', 'IS/WAS', isNavigationView, wasNavigationView); - if (isNavigationView != wasNavigationView) { - if (isNavigationView) { - pandora.$ui.sortSelect.remove(); - pandora.$ui.orderButton.remove(); - } else { - pandora.$ui.sortSelect = pandora.ui.sortSelect().insertAfter(pandora.$ui.viewSelect); - pandora.$ui.orderButton = pandora.ui.orderButton().insertAfter(pandora.$ui.sortSelect); + var isNavigationView, wasNavigationView; + if (!pandora.user.ui.item) { + isNavigationView = ['map', 'calendar'].indexOf(data.value) > -1; + wasNavigationView = ['map', 'calendar'].indexOf(data.previousValue) > -1; + if (isNavigationView != wasNavigationView) { + if (isNavigationView) { + pandora.$ui.sortSelect.remove(); + pandora.$ui.orderButton.remove(); + } else { + pandora.$ui.sortSelect = pandora.ui.sortSelect().insertAfter(pandora.$ui.viewSelect); + pandora.$ui.orderButton = pandora.ui.orderButton().insertAfter(pandora.$ui.sortSelect); + } + } else if ((data.value == 'clip') != (data.previousValue == 'clip')) { + pandora.$ui.sortSelect.replaceWith( + pandora.$ui.sortSelect = pandora.ui.sortSelect() + ); } - } else if ((data.value == 'clip') != (data.previousValue == 'clip')) { - pandora.$ui.sortSelect.replaceWith( - pandora.$ui.sortSelect = pandora.ui.sortSelect() - ); } } })