[Menus] Dismiss menu when clicked

Addresses WTD-1506 (context menu does not disappear after
action is chosen); listen for click events on the menu
itself and dismiss the menu when these occur.
This commit is contained in:
Victor Woeltjen 2015-08-07 14:34:27 -07:00
parent 7ded288154
commit 87aa0cfce2

View File

@ -31,7 +31,8 @@ define(
var MENU_TEMPLATE = "<mct-representation key=\"'context-menu'\" " +
"mct-object=\"domainObject\" " +
"ng-class=\"menuClass\"" +
"ng-click=\"dismiss()\" " +
"ng-class=\"menuClass\" " +
"ng-style=\"menuStyle\">" +
"</mct-representation>",
dismissExistingMenu;
@ -62,7 +63,7 @@ define(
// Remove the context menu
function dismiss() {
menu.remove();
body.off("click", dismiss);
body.off("mousedown", dismiss);
dismissExistingMenu = undefined;
}
@ -86,6 +87,7 @@ define(
"go-up": goUp,
"context-menu-holder": true
};
scope.dismiss = dismiss;
// Create the context menu
menu = $compile(MENU_TEMPLATE)(scope);