pandora/static/js/pandora/ui/orderButton.js
2011-09-23 10:44:54 +00:00

34 lines
No EOL
974 B
JavaScript

// vim: et:ts=4:sw=4:sts=4:ft=javascript
pandora.ui.orderButton = function() {
var that = Ox.Button({
id: 'orderButton',
title: getTitle(),
// tooltip: 'Change sort order',
type: 'image'
})
.css({
float: 'left',
margin: '4px 0 0 4px'
})
.bindEvent({
click: function(data) {
pandora.UI.set({
listSort: [{
key: pandora.user.ui.listSort[0].key,
operator: pandora.user.ui.listSort[0].operator == '+' ? '-' : '+'
}]
})
that.options({title: getTitle()});
}
});
function getTitle() {
return pandora.user.ui.listSort[0].operator == '+' ? 'up' : 'down';
}
Ox.Event.bind({
listSort: function() {
that.options({title: getTitle()});
}
});
return that;
}