working around a bug where the backend doesn't send the type property of pandora.site.groups

This commit is contained in:
rolux 2011-09-17 23:50:38 +00:00
parent 0f64867884
commit 23952e7763

View file

@ -202,8 +202,11 @@ pandora.ui.mainMenu = function() {
var groups = Ox.clone(pandora.user.ui.groups), var groups = Ox.clone(pandora.user.ui.groups),
id = data.id.replace('sortgroup', ''), id = data.id.replace('sortgroup', ''),
position = Ox.getPositionById(groups, id), position = Ox.getPositionById(groups, id),
// fixme: the backend mysteriously omits type
type = Ox.getObjectById(pandora.site.groups, id).type,
key = value, key = value,
operator = '-'; operator = key == 'name' && type == 'string' ? '+' : '-';
pandora.$ui.mainMenu.checkItem('sortMenu_ordergroups_ordergroup' + id + '_' + (operator == '+' ? 'ascending' : 'descending'))
pandora.$ui.groups[position].options({ pandora.$ui.groups[position].options({
sort: [{key: key, operator: operator}] sort: [{key: key, operator: operator}]
}); });
@ -247,7 +250,6 @@ pandora.ui.mainMenu = function() {
pandora.$ui.viewSelect.options({value: value}); pandora.$ui.viewSelect.options({value: value});
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.list = pandora.ui.list()); pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.list = pandora.ui.list());
pandora.URL.push('/' + value + '/' + document.location.search); pandora.URL.push('/' + value + '/' + document.location.search);
} }
}, },
click: function(data) { click: function(data) {