From 865188d97d2a1787f09212a57c795ca1b50be70b Mon Sep 17 00:00:00 2001 From: rolux Date: Fri, 17 Jan 2014 09:55:53 +0000 Subject: [PATCH] add section selection to view menu --- static/js/mainMenu.js | 18 ++++++++++++++++-- static/js/sectionSelect.js | 2 +- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/static/js/mainMenu.js b/static/js/mainMenu.js index 089d6bbd..6c72c3db 100644 --- a/static/js/mainMenu.js +++ b/static/js/mainMenu.js @@ -50,7 +50,18 @@ pandora.ui.mainMenu = function() { getListMenu(), getItemMenu(), { id: 'viewMenu', title: Ox._('View'), items: [ - { id: 'items', title: Ox._('View {0}', [Ox._(pandora.site.itemName.plural)]), items: [ + { id: 'section', title: Ox._('Section'), items: [ + { group: 'viewsection', min: 1, max: 1, items: Object.keys(pandora.site.sectionFolders).map(function(section) { + return { + id: section, + title: section == 'items' ? Ox._(pandora.site.itemName.plural) : Ox.toTitleCase(section), + checked: ui.section == section, + disabled: section != 'items' && pandora.user.level != 'admin' + }; + }) } + ] }, + {}, + { id: 'movies', title: Ox._('View {0}', [Ox._(pandora.site.itemName.plural)]), items: [ { group: 'listview', min: 1, max: 1, items: pandora.site.listViews.map(function(view) { return Ox.extend({ checked: ui.listView == view.id @@ -335,6 +346,8 @@ pandora.ui.mainMenu = function() { operator: '&' } }); + } else if (data.id == 'viewsection') { + pandora.UI.set({section: value}); } else if (data.id == 'viewtimelines') { pandora.UI.set({videoTimeline: value}); } @@ -738,7 +751,8 @@ pandora.ui.mainMenu = function() { pandora.getItemIdAndPosition() ? 'enableItem' : 'disableItem' ]('findsimilar'); }, - pandora_section: function() { + pandora_section: function(data) { + that.checkItem('viewMenu_section_' + data.value); that.replaceMenu('listMenu', getListMenu()); that.replaceMenu('itemMenu', getItemMenu()); that.replaceMenu('sortMenu', getSortMenu()); diff --git a/static/js/sectionSelect.js b/static/js/sectionSelect.js index 90a99105..543527a5 100644 --- a/static/js/sectionSelect.js +++ b/static/js/sectionSelect.js @@ -15,7 +15,7 @@ pandora.ui.sectionSelect = function(section) { margin: '4px' }) .bindEvent({ - + // ... }); return that; };