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})
.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)

View file

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

View file

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

View file

@ -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()
);
}
}