LP1760599: Only show merge records action when multiple bucket records selected
authorJane Sandberg <sandbej@linnbenton.edu>
Thu, 6 Dec 2018 23:49:40 +0000 (15:49 -0800)
committerGalen Charlton <gmc@equinoxinitiative.org>
Thu, 23 May 2019 21:29:41 +0000 (17:29 -0400)
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>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>

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 a9fa25e..e7c80d3 100644 (file)
@@ -788,6 +788,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 });