add extra menu for admins
This commit is contained in:
parent
dc3d850a09
commit
86253cd60e
1 changed files with 60 additions and 0 deletions
60
static/js/localInit.cms.js
Normal file
60
static/js/localInit.cms.js
Normal file
|
@ -0,0 +1,60 @@
|
|||
|
||||
pandora.localInitInit = function() {
|
||||
var plugins = [];
|
||||
|
||||
if (pandora.user.level == 'admin') {
|
||||
plugins.push(ExtrasMenu());
|
||||
}
|
||||
|
||||
plugins.length && load();
|
||||
|
||||
function load() {
|
||||
patchReload();
|
||||
plugins.forEach(function(plugin) { plugin.load() });
|
||||
}
|
||||
|
||||
function patchReload() {
|
||||
var reload = pandora.$ui.appPanel.reload;
|
||||
pandora.$ui.appPanel.reload = function() {
|
||||
reload();
|
||||
load();
|
||||
}
|
||||
}
|
||||
|
||||
function ExtrasMenu() {
|
||||
var that = {};
|
||||
|
||||
var css = {
|
||||
//margin: '2px',
|
||||
},
|
||||
$item = Ox.MenuButton({
|
||||
items: [
|
||||
{'id': 'rename', title: 'Rename Keyword'},
|
||||
{'id': 'ontology_graph', title: 'Ontology Graph'},
|
||||
{'id': 'ontology', title: 'Ontology Overview'},
|
||||
],
|
||||
style: 'rounded',
|
||||
title: 'set',
|
||||
tooltip: Ox._('Extras'),
|
||||
type: 'image'
|
||||
}).css(css).bindEvent({
|
||||
click: function(data) {
|
||||
if (data.id == 'rename') {
|
||||
pandora.ui.renameKeywordDialog().open()
|
||||
} else if (data.id == 'ontology_graph') {
|
||||
pandora.openLink('/static/ontology/');
|
||||
} else if (data.id == 'ontology') {
|
||||
pandora.openLink('/static/ontology/ontology.html');
|
||||
}
|
||||
},
|
||||
}),
|
||||
plugins = [];
|
||||
|
||||
that.load = function() {
|
||||
pandora.$ui.mainMenu.find('.OxExtras').prepend($item);
|
||||
pandora.$ui.extraItem = $item;
|
||||
};
|
||||
return that;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue