From 81ac4826e4fac4bb312dd5529a27f0ba07a32ffc Mon Sep 17 00:00:00 2001 From: rolux Date: Sun, 18 Sep 2011 00:31:41 +0000 Subject: [PATCH] make groups resettable --- static/js/pandora.js | 7 +++++++ static/js/pandora/pandora.js | 1 - static/js/pandora/ui/group.js | 3 ++- static/js/pandora/ui/menu.js | 11 +++++++++-- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/static/js/pandora.js b/static/js/pandora.js index 3e8b4b43..d3cbe43d 100644 --- a/static/js/pandora.js +++ b/static/js/pandora.js @@ -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, { diff --git a/static/js/pandora/pandora.js b/static/js/pandora/pandora.js index 7643ce4e..c040c8d6 100644 --- a/static/js/pandora/pandora.js +++ b/static/js/pandora/pandora.js @@ -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 diff --git a/static/js/pandora/ui/group.js b/static/js/pandora/ui/group.js index 8e9fe6f7..0d769deb 100644 --- a/static/js/pandora/ui/group.js +++ b/static/js/pandora/ui/group.js @@ -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')); diff --git a/static/js/pandora/ui/menu.js b/static/js/pandora/ui/menu.js index 9e1dff53..bb9e6b66 100644 --- a/static/js/pandora/ui/menu.js +++ b/static/js/pandora/ui/menu.js @@ -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();