From: Mike Rylander Date: Mon, 9 Feb 2015 22:19:34 +0000 (-0500) Subject: LP#1402797 Make grid context menu safer and more state-aware X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=c678719f0b404091cf17f533714305a1d90b36a3;p=evergreen%2Fmasslnc.git LP#1402797 Make grid context menu safer and more state-aware Signed-off-by: Mike Rylander Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/web/js/ui/default/staff/services/grid.js b/Open-ILS/web/js/ui/default/staff/services/grid.js index f5f1237693..42330b12d3 100644 --- a/Open-ILS/web/js/ui/default/staff/services/grid.js +++ b/Open-ILS/web/js/ui/default/staff/services/grid.js @@ -501,17 +501,28 @@ angular.module('egGridMod', $($scope.action_context_parent).append(menu_dom); $scope.action_context_oldy = $scope.action_context_oldx = 0; $('body').unbind('click.remove_context_menu'); + $scope.action_context_showing = false; } + $scope.action_context_showing = false; $scope.showActionContextMenu = function ($event) { - var menu_dom = $($scope.grid_element).find('.grid-action-dropdown')[0]; - $scope.action_context_width = $(menu_dom).css('width'); - $scope.action_context_y = $(menu_dom).css('top'); - $scope.action_context_x = $(menu_dom).css('left'); - $scope.action_context_parent = $(menu_dom).parent(); - - $('body').append($(menu_dom)); - $('body').bind('click.remove_context_menu', $scope.hideActionContextMenu); + var current_parent = $scope.grid_element; + if ($scope.action_context_showing) { + current_parent = $('body'); + } + + var menu_dom = $(current_parent).find('.grid-action-dropdown')[0]; + + if (!$scope.action_context_showing) { + $scope.action_context_width = $(menu_dom).css('width'); + $scope.action_context_y = $(menu_dom).css('top'); + $scope.action_context_x = $(menu_dom).css('left'); + $scope.action_context_parent = $(menu_dom).parent(); + $scope.action_context_showing = true; + + $('body').append($(menu_dom)); + $('body').bind('click.remove_context_menu', $scope.hideActionContextMenu); + } $(menu_dom).css({ display: 'block',