From aaf444ae96af97ec4e9dd08173970e19bbd6eb0e Mon Sep 17 00:00:00 2001 From: j Date: Tue, 12 Nov 2019 17:48:10 +0000 Subject: [PATCH] hide unused dialogs from menu --- static/js/mainMenu.js | 6 ++++-- static/js/utils.js | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/static/js/mainMenu.js b/static/js/mainMenu.js index b797b4bdc..87bfbc524 100644 --- a/static/js/mainMenu.js +++ b/static/js/mainMenu.js @@ -229,8 +229,10 @@ pandora.ui.mainMenu = function() { { id: 'names', title: Ox._('Manage Names...'), disabled: !pandora.hasCapability('canManageTitlesAndNames') }, { id: 'translations', title: Ox._('Manage Translations...'), disabled: !pandora.hasCapability('canManageTranslations') }, {}, - { id: 'places', title: Ox._('Manage Places...'), disabled: !pandora.hasCapability('canManagePlacesAndEvents') }, - { id: 'events', title: Ox._('Manage Events...'), disabled: !pandora.hasCapability('canManagePlacesAndEvents') }, + pandora.hasView('map') + ? [{ id: 'places', title: Ox._('Manage Places...'), disabled: !pandora.hasCapability('canManagePlacesAndEvents') }] : [], + pandora.hasView('calendar') + ? [{ id: 'events', title: Ox._('Manage Events...'), disabled: !pandora.hasCapability('canManagePlacesAndEvents') }] : [], {}, { id: 'users', title: Ox._('Manage Users...'), disabled: !pandora.hasCapability('canManageUsers') }, { id: 'statistics', title: Ox._('Statistics...'), disabled: !pandora.hasCapability('canManageUsers') }, diff --git a/static/js/utils.js b/static/js/utils.js index 32c40c08c..ae2758cc8 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -2489,6 +2489,9 @@ pandora.hasPlacesLayer = function() { }); }; +pandora.hasView = function(id) { + return !!(Ox.getObjectById(pandora.site.itemViews, id) || Ox.getObjectById(pandora.site.listViews, id)) +}; pandora.isClipView = function(view, item) { if (pandora.user.ui.section == 'items') {