From 794e65411456dd9ecbb6d8a978ec2467a4f102d2 Mon Sep 17 00:00:00 2001 From: rolux Date: Sun, 6 Nov 2011 00:05:09 +0000 Subject: [PATCH] add tooltip to order button --- static/js/pandora/orderButton.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/static/js/pandora/orderButton.js b/static/js/pandora/orderButton.js index 5812afb8..09f27c54 100644 --- a/static/js/pandora/orderButton.js +++ b/static/js/pandora/orderButton.js @@ -5,6 +5,7 @@ pandora.ui.orderButton = function(isNavigationView) { that = Ox.Button({ id: 'orderButton', title: getTitle(), + tooltip: getTooltip(), // tooltip: 'Change sort order', type: 'image' }) @@ -18,17 +19,22 @@ pandora.ui.orderButton = function(isNavigationView) { key: pandora.user.ui[sortKey][0].key, operator: pandora.user.ui[sortKey][0].operator == '+' ? '-' : '+' }]); - that.options({title: getTitle()}); + updateButton(); }, - pandora_listsort: function() { - that.options({title: getTitle()}); - }, - pandora_itemsort: function() { - that.options({title: getTitle()}); - } + pandora_listsort: updateButton, + pandora_itemsort: updateButton }); function getTitle() { return pandora.user.ui[sortKey][0].operator == '+' ? 'up' : 'down'; } + function getTooltip() { + return pandora.user.ui[sortKey][0].operator == '+' ? 'Ascending' : 'Descending'; + } + function updateButton() { + that.options({ + title: getTitle(), + tooltip: getTooltip() + }); + } return that; } \ No newline at end of file