cosmetic changes

This commit is contained in:
rolux 2014-01-07 13:22:22 +05:30
parent a12e9624e1
commit b40b01dd3a

View file

@ -4,26 +4,27 @@
pandora.ui.sortElement = function(isNavigationView) { pandora.ui.sortElement = function(isNavigationView) {
var isClipView = pandora.isClipView(), var ui = pandora.user.ui,
isClipView = pandora.isClipView(),
isEmbed = pandora.isEmbedURL(), isEmbed = pandora.isEmbedURL(),
items = ( items = (
isClipView ? pandora.site.clipKeys.map(function(key) { isClipView ? pandora.site.clipKeys.map(function(key) {
return Ox.extend(Ox.clone(key), { return Ox.extend(Ox.clone(key), {
title: Ox._((!pandora.user.ui.item ? 'Sort by Clip {0}' : 'Sort by {0}'), [Ox._(key.title)]) title: Ox._((!ui.item ? 'Sort by Clip {0}' : 'Sort by {0}'), [Ox._(key.title)])
}); });
}) : [] }) : []
).concat( ).concat(
!pandora.user.ui.item ? pandora.site.sortKeys.map(function(key) { !ui.item ? pandora.site.sortKeys.map(function(key) {
return Ox.extend(Ox.clone(key), { return Ox.extend(Ox.clone(key), {
title: Ox._('Sort by {0}', [Ox._(key.title)]) title: Ox._('Sort by {0}', [Ox._(key.title)])
}); });
}) : [] }) : []
), ),
sortKey = !pandora.user.ui.item ? 'listSort' : 'itemSort', sortKey = !ui.item ? 'listSort' : 'itemSort',
$sortSelect = Ox.Select({ $sortSelect = Ox.Select({
items: items, items: items,
value: pandora.user.ui[sortKey][0].key, value: ui[sortKey][0].key,
width: !isEmbed && isNavigationView ? 120 + Ox.UI.SCROLLBAR_SIZE : 144 width: !isEmbed && isNavigationView ? 120 + Ox.UI.SCROLLBAR_SIZE : 144
}) })
.bindEvent({ .bindEvent({
@ -45,8 +46,8 @@ pandora.ui.sortElement = function(isNavigationView) {
.bindEvent({ .bindEvent({
click: function() { click: function() {
pandora.UI.set(sortKey, [{ pandora.UI.set(sortKey, [{
key: pandora.user.ui[sortKey][0].key, key: ui[sortKey][0].key,
operator: pandora.user.ui[sortKey][0].operator == '+' ? '-' : '+' operator: ui[sortKey][0].operator == '+' ? '-' : '+'
}]); }]);
} }
}), }),
@ -62,15 +63,15 @@ pandora.ui.sortElement = function(isNavigationView) {
.bindEvent('pandora_' + sortKey.toLowerCase(), updateElement); .bindEvent('pandora_' + sortKey.toLowerCase(), updateElement);
function getButtonTitle() { function getButtonTitle() {
return pandora.user.ui[sortKey][0].operator == '+' ? 'up' : 'down'; return ui[sortKey][0].operator == '+' ? 'up' : 'down';
} }
function getButtonTooltip() { function getButtonTooltip() {
return Ox._(pandora.user.ui[sortKey][0].operator == '+' ? 'Ascending' : 'Descending'); return Ox._(ui[sortKey][0].operator == '+' ? 'Ascending' : 'Descending');
} }
function updateElement() { function updateElement() {
$sortSelect.value(pandora.user.ui[sortKey][0].key); $sortSelect.value(ui[sortKey][0].key);
$orderButton.options({ $orderButton.options({
title: getButtonTitle(), title: getButtonTitle(),
tooltip: getButtonTooltip() tooltip: getButtonTooltip()