pandora_amp/static/js/localInit.amp.js

54 lines
1.4 KiB
JavaScript
Raw Permalink Normal View History

2018-11-05 19:45:42 +00:00
pandora.localInit = function() {
var plugins = [];
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: [
].concat(pandora.user.level == 'admin' ? [
2018-11-05 20:27:03 +00:00
] : [], pandora.user.level == 'gurest' ? [] : [
2018-11-05 19:45:42 +00:00
{id: 'import_documents', title: 'Import Documents...'},
]),
style: 'rounded',
title: 'set',
tooltip: Ox._('Extras'),
type: 'image'
}).css(css).bindEvent({
click: function(data) {
if (data.id == 'import_documents') {
2018-11-05 20:27:03 +00:00
pandora.ui.importDocumentsDialog().open();
2018-11-05 19:45:42 +00:00
}
},
}),
plugins = [];
that.load = function() {
pandora.$ui.mainMenu.find('.OxExtras').prepend($item);
pandora.$ui.extraItem = $item;
};
return that;
}
}