pandora_amp/static/js/localInit.amp.js
2018-11-05 20:45:42 +01:00

53 lines
1.4 KiB
JavaScript

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' ? [
] : [], [
{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') {
pandora.ui.importDocumentsDialog().open()
}
},
}),
plugins = [];
that.load = function() {
pandora.$ui.mainMenu.find('.OxExtras').prepend($item);
pandora.$ui.extraItem = $item;
};
return that;
}
}