LP1760599: Only show merge records action when multiple bucket records selected user/rogan/lp1760599
authorJane Sandberg <sandbej@linnbenton.edu>
Thu, 6 Dec 2018 23:49:40 +0000 (15:49 -0800)
committerRogan Hamby <rogan.hamby@gmail.com>
Tue, 5 Mar 2019 21:00:46 +0000 (16:00 -0500)
To test:
1) Create a bucket.
2) Select one record from your bucket. Right-click on your record or click on the Actions drop-down.
3) Note that "Merge Selected Records" is clickable.
4) Apply this commit.
5) Repeat steps 2-3.  Note that "Merge Selected Records" is no longer
clickable, unless you select two or more records.

Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Signed-off-by: Rogan Hamby <rogan.hamby@gmail.com>
Open-ILS/src/templates/staff/cat/bucket/record/t_view.tt2
Open-ILS/web/js/ui/default/staff/cat/bucket/record/app.js

index 02aa7f5..ab7461b 100644 (file)
@@ -23,6 +23,7 @@
     label="[% l('Transfer Title Holds') %]"></eg-grid-action>
 
   <eg-grid-action label="[% l('Merge Selected Records') %]" 
+    disabled="need_multiple_selected"
     handler="openRecordMergeDialog"></eg-grid-action>
 
   <eg-grid-action label="[% l('Export Records') %]" 
index aebfb25..8a29981 100644 (file)
@@ -775,6 +775,12 @@ function($scope,  $q , $routeParams,  bucketSvc,  egCore,  $window,
         });
     }
 
+    $scope.need_multiple_selected = function() {
+        var items = $scope.gridControls.selectedItems();
+        if (items.length > 1) return false;
+        return true;
+    }
+
     // fetch the bucket;  on error show the not-allowed message
     if ($scope.bucketId) 
         drawBucket()['catch'](function() { $scope.forbidden = true });