make groups resettable

This commit is contained in:
rolux 2011-09-18 00:31:41 +00:00
parent 23952e7763
commit 81ac4826e4
4 changed files with 18 additions and 4 deletions

View file

@ -63,6 +63,13 @@ Ox.load({
]
}
};
pandora.site.user.ui.groups = [
{"id": "director", "sort": [{"key": "items", "operator": "-"}]},
{"id": "country", "sort": [{"key": "items", "operator": "-"}]},
{"id": "year", "sort": [{"key": "name", "operator": "-"}]},
{"id": "language", "sort": [{"key": "items", "operator": "-"}]},
{"id": "genre", "sort": [{"key": "items", "operator": "-"}]}
];
// ----
Ox.print("USER.UI.LISTS", data.user.ui.lists, "SITE.USER.UI.LISTS", data.site.user.ui.lists)
Ox.extend(pandora.site, {

View file

@ -373,7 +373,6 @@ pandora.getSortMenu = function() {
};
pandora.getSortOperator = function(key) { // fixme: make static
Ox.print('getSortOperator', key)
var type = Ox.getObjectById(
/^clip:/.test(key) ? pandora.site.clipKeys : pandora.site.itemKeys,
key

View file

@ -40,7 +40,7 @@ pandora.ui.group = function(id) {
)
: value
},
operator: group.type == 'integer' ? '-' : '+',
operator: group.type == 'string' ? '+' : '-',
title: title,
unique: true,
visible: true,
@ -128,6 +128,7 @@ pandora.ui.group = function(id) {
pandora.reloadGroups(i);
},
sort: function(data) {
Ox.print('SORT', data)
var groups = Ox.clone(pandora.user.ui.groups);
pandora.$ui.mainMenu.checkItem('sortMenu_sortgroups_sortgroup' + id + '_' + data.key);
pandora.$ui.mainMenu.checkItem('sortMenu_ordergroups_ordergroup' + id + '_' + (data.operator == '+' ? 'ascending' : 'descending'));

View file

@ -85,7 +85,7 @@ pandora.ui.mainMenu = function() {
{ id: 'loadcolumns', title: 'Load Layout...' },
{ id: 'savecolumns', title: 'Save Layout...' },
{},
{ id: 'resetcolumns', title: 'Reset to Default' }
{ id: 'resetcolumns', title: 'Reset Layout' }
]},
{},
{ id: 'openmovie', title: ['Open ' + pandora.site.itemName.singular, 'Open ' + pandora.site.itemName.plural], items: [
@ -106,7 +106,9 @@ pandora.ui.mainMenu = function() {
return Ox.extend({
checked: Ox.getPositionById(pandora.user.ui.groups, group.id) > -1
}, group);
}) }
}) },
{},
{ id: 'resetgroups', title: 'Reset Groups' }
] },
{},
{ id: 'lists', title: 'Hide Lists', keyboard: 'shift l' },
@ -574,6 +576,11 @@ pandora.ui.mainMenu = function() {
title: 'Query',
width: 384
}).open();
} else if (data.id == 'resetgroups') {
pandora.UI.set({
groups: pandora.site.user.ui.groups
});
pandora.$ui.contentPanel.replaceElement(0, pandora.$ui.browser = pandora.ui.browser());
} else if (data.id == 'resetui') {
pandora.api.resetUI({}, function() {
pandora.$ui.appPanel.reload();