From 3dccd07340ba4316dc18a4abf485086dbd7de375 Mon Sep 17 00:00:00 2001 From: rolux Date: Mon, 31 Oct 2011 14:22:28 +0000 Subject: [PATCH] on toolbar, don't show/hide but remove/insert sort select and order button --- static/js/pandora/navigationView.js | 4 ++-- static/js/pandora/sortMenu.js | 2 ++ static/js/pandora/sortSelect.js | 1 - static/js/pandora/toolbar.js | 20 ++++++++++---------- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/static/js/pandora/navigationView.js b/static/js/pandora/navigationView.js index 92b30914..67e001a6 100644 --- a/static/js/pandora/navigationView.js +++ b/static/js/pandora/navigationView.js @@ -17,10 +17,10 @@ pandora.ui.navigationView = function(type, videoRatio) { $toolbar = Ox.Bar({size: 24}) .append( - pandora.$ui.navigationViewOrderButton = pandora.ui.orderButton(true) + pandora.$ui.orderButton = pandora.ui.orderButton(true) ) .append( - pandora.$ui.navigationViewSortSelect = pandora.ui.sortSelect(true) + pandora.$ui.sortSelect = pandora.ui.sortSelect(true) ), $list = pandora.ui.clipList(videoRatio) diff --git a/static/js/pandora/sortMenu.js b/static/js/pandora/sortMenu.js index f3fac887..a376c4d9 100644 --- a/static/js/pandora/sortMenu.js +++ b/static/js/pandora/sortMenu.js @@ -2,6 +2,8 @@ pandora.ui.sortMenu = function() { + // fixme: unused + var that = Ox.Select({ items: Ox.merge( pandora.site.clipKeys.map(function(key) { diff --git a/static/js/pandora/sortSelect.js b/static/js/pandora/sortSelect.js index 9015611d..b499f03b 100644 --- a/static/js/pandora/sortSelect.js +++ b/static/js/pandora/sortSelect.js @@ -49,7 +49,6 @@ pandora.ui.sortSelect = function(isNavigationView) { that.selectItem(data.value[0].key); } }); - return that; }; diff --git a/static/js/pandora/toolbar.js b/static/js/pandora/toolbar.js index ee80a11f..ade17c4c 100644 --- a/static/js/pandora/toolbar.js +++ b/static/js/pandora/toolbar.js @@ -15,15 +15,11 @@ pandora.ui.toolbar = function() { that.append( pandora.$ui.viewSelect = pandora.ui.viewSelect() ); - !ui.item && that.append( + !ui.item && !isNavigationView && that.append( pandora.$ui.sortSelect = pandora.ui.sortSelect() ).append( pandora.$ui.orderButton = pandora.ui.orderButton() ); - if (isNavigationView) { - pandora.$ui.sortSelect.hide(); - pandora.$ui.orderButton.hide(); - } ui.item && that.append( pandora.$ui.itemTitle = Ox.Label({ textAlign: 'center' @@ -47,12 +43,16 @@ pandora.ui.toolbar = function() { action = isNavigationView ? 'hide' : 'show'; Ox.print('IS/WAS', isNavigationView, wasNavigationView); if (isNavigationView != wasNavigationView) { - pandora.$ui.sortSelect[action](); - pandora.$ui.orderButton[action](); - } - if (pandora.isClipView() != pandora.isClipView(data.previousValue)) { + if (isNavigationView) { + pandora.$ui.sortSelect.removeElement(); + pandora.$ui.orderButton.removeElement(); + } 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()[action]() + pandora.$ui.sortSelect = pandora.ui.sortSelect() ); } }