From 23952e77634daf9f3f9b2cb601559fee027d827c Mon Sep 17 00:00:00 2001 From: rolux Date: Sat, 17 Sep 2011 23:50:38 +0000 Subject: [PATCH] working around a bug where the backend doesn't send the type property of pandora.site.groups --- static/js/pandora/ui/menu.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/static/js/pandora/ui/menu.js b/static/js/pandora/ui/menu.js index 6cbeea65..9e1dff53 100644 --- a/static/js/pandora/ui/menu.js +++ b/static/js/pandora/ui/menu.js @@ -202,8 +202,11 @@ pandora.ui.mainMenu = function() { var groups = Ox.clone(pandora.user.ui.groups), id = data.id.replace('sortgroup', ''), position = Ox.getPositionById(groups, id), + // fixme: the backend mysteriously omits type + type = Ox.getObjectById(pandora.site.groups, id).type, key = value, - operator = '-'; + operator = key == 'name' && type == 'string' ? '+' : '-'; + pandora.$ui.mainMenu.checkItem('sortMenu_ordergroups_ordergroup' + id + '_' + (operator == '+' ? 'ascending' : 'descending')) pandora.$ui.groups[position].options({ sort: [{key: key, operator: operator}] }); @@ -247,7 +250,6 @@ pandora.ui.mainMenu = function() { pandora.$ui.viewSelect.options({value: value}); pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.list = pandora.ui.list()); pandora.URL.push('/' + value + '/' + document.location.search); - } }, click: function(data) {