plugins = [],
actionDefinitions = {},
config,
- actionsAppObject;
+ actionsAppObject,
+ currentContextMenu;
_.each(_.keys(modules || {}), function(moduleName) {
if(_.contains(app.permissions[moduleName] || [], 'handleEvents')) {
this.registerActionsAppObject = function(_actionsAppObject) {
actionsAppObject = _actionsAppObject;
};
+
+ this.showContextMenu = function(menu, coors) {
+ if(currentContextMenu) {
+ currentContextMenu.close();
+ }
+ currentContextMenu = menu;
+ $(config.rootSelector).append(menu.dom);
+ menu.dom.css({top: coors.y, left: coors.x});
+ menu.show();
+ };
};
-
-
+
this.setBootstrappedData = function(moduleName, data) {
bootstrappedData[moduleName] = data;
};
app.initModules.forEach(function(moduleName) {
getModuleInstance(moduleName).start();
});
+
+ $(config.rootSelector)[0].addEventListener('click', function(e) {
+ if(currentContextMenu && !currentContextMenu.dom[0].contains(e.target)) {
+ currentContextMenu.close();
+ currentContextMenu = null;
+ }
+ }, true);
};
};