[open-ils-commits] [GIT] Evergreen ILS branch rel_3_0 updated. ecaca5004596039b4b8893589f234899afd4f469

Evergreen Git git at git.evergreen-ils.org
Wed Jul 11 16:07:34 EDT 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, rel_3_0 has been updated
       via  ecaca5004596039b4b8893589f234899afd4f469 (commit)
      from  1cb1eb6cc636b4108f23895faa9dba5b4d010955 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ecaca5004596039b4b8893589f234899afd4f469
Author: a. bellenir <ab at grpl.org>
Date:   Tue Jun 19 18:25:05 2018 -0400

    LP#1669856 and LP#1776557: right clicks on egGrid
    
    select the row if right-clicking on a row that is not selected.
    use the defult browser context-menu when right-clicking on links in eg grids.
    
    Signed-off-by: a. bellenir <ab at grpl.org>
    Signed-off-by: Michele Morgan <mmorgan at noblenet.org>
    Signed-off-by: Chris Sharp <csharp at georgialibraries.org>

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 77ab238..dff9e9d 100644
--- a/Open-ILS/web/js/ui/default/staff/services/grid.js
+++ b/Open-ILS/web/js/ui/default/staff/services/grid.js
@@ -643,8 +643,23 @@ angular.module('egGridMod',
                 if (!$scope.menu_dom) $scope.menu_dom = $($scope.grid_element).find('.grid-action-dropdown')[0];
                 if (!$scope.action_context_parent) $scope.action_context_parent = $($scope.menu_dom).parent();
 
-                if (!grid.getSelectedItems().length) // Nothing selected, fire the click event
-                    $event.target.click();
+                // we need the index of the row that got right-clicked...
+                var e = $event.target; // the DOM element
+                var s = undefined;     // the angular scope for that element
+                while(e){ // searching for the row so we can get its index from s.$index
+                    // abort & use the browser default context menu for links (lp1669856):
+                    if(e.tagName.toLowerCase() === 'a' && e.href){ return true; }
+                    s = angular.element(e).scope();
+                    if(s.hasOwnProperty('item')){ break; }
+                    e = e.parentElement;
+                }
+                /* $scope.items and $scope.selected indexes are "backwards" to each other.
+                $scope.items counts down from the top of the list (most recent item first)
+                $scope.selected counts forward as items are scanned (most recent item last)
+                s.$index is for $scope.items. we need the index for $scope.selected: */
+                var selectable_index = ($scope.items.length-1) - s.$index;
+                // select the right-clicked row if it is not already selected (lp1776557):
+                if(!$scope.selected[selectable_index]){ $event.target.click(); }
 
                 if (!$scope.action_context_showing) {
                     $scope.action_context_width = $($scope.menu_dom).css('width');

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/web/js/ui/default/staff/services/grid.js |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list