on toolbar, don't show/hide but remove/insert sort select and order button

This commit is contained in:
rolux 2011-10-31 14:22:28 +00:00
parent 234c5fc760
commit 3dccd07340
4 changed files with 14 additions and 13 deletions

View file

@ -17,10 +17,10 @@ pandora.ui.navigationView = function(type, videoRatio) {
$toolbar = Ox.Bar({size: 24}) $toolbar = Ox.Bar({size: 24})
.append( .append(
pandora.$ui.navigationViewOrderButton = pandora.ui.orderButton(true) pandora.$ui.orderButton = pandora.ui.orderButton(true)
) )
.append( .append(
pandora.$ui.navigationViewSortSelect = pandora.ui.sortSelect(true) pandora.$ui.sortSelect = pandora.ui.sortSelect(true)
), ),
$list = pandora.ui.clipList(videoRatio) $list = pandora.ui.clipList(videoRatio)

View file

@ -2,6 +2,8 @@
pandora.ui.sortMenu = function() { pandora.ui.sortMenu = function() {
// fixme: unused
var that = Ox.Select({ var that = Ox.Select({
items: Ox.merge( items: Ox.merge(
pandora.site.clipKeys.map(function(key) { pandora.site.clipKeys.map(function(key) {

View file

@ -49,7 +49,6 @@ pandora.ui.sortSelect = function(isNavigationView) {
that.selectItem(data.value[0].key); that.selectItem(data.value[0].key);
} }
}); });
return that; return that;
}; };

View file

@ -15,15 +15,11 @@ pandora.ui.toolbar = function() {
that.append( that.append(
pandora.$ui.viewSelect = pandora.ui.viewSelect() pandora.$ui.viewSelect = pandora.ui.viewSelect()
); );
!ui.item && that.append( !ui.item && !isNavigationView && that.append(
pandora.$ui.sortSelect = pandora.ui.sortSelect() pandora.$ui.sortSelect = pandora.ui.sortSelect()
).append( ).append(
pandora.$ui.orderButton = pandora.ui.orderButton() pandora.$ui.orderButton = pandora.ui.orderButton()
); );
if (isNavigationView) {
pandora.$ui.sortSelect.hide();
pandora.$ui.orderButton.hide();
}
ui.item && that.append( ui.item && that.append(
pandora.$ui.itemTitle = Ox.Label({ pandora.$ui.itemTitle = Ox.Label({
textAlign: 'center' textAlign: 'center'
@ -47,12 +43,16 @@ pandora.ui.toolbar = function() {
action = isNavigationView ? 'hide' : 'show'; action = isNavigationView ? 'hide' : 'show';
Ox.print('IS/WAS', isNavigationView, wasNavigationView); Ox.print('IS/WAS', isNavigationView, wasNavigationView);
if (isNavigationView != wasNavigationView) { if (isNavigationView != wasNavigationView) {
pandora.$ui.sortSelect[action](); if (isNavigationView) {
pandora.$ui.orderButton[action](); pandora.$ui.sortSelect.removeElement();
} pandora.$ui.orderButton.removeElement();
if (pandora.isClipView() != pandora.isClipView(data.previousValue)) { } 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.replaceWith(
pandora.$ui.sortSelect = pandora.ui.sortSelect()[action]() pandora.$ui.sortSelect = pandora.ui.sortSelect()
); );
} }
} }