LP#1539089 Webstaff grid actions disabled until selected.
authorBill Erickson <berickxx@gmail.com>
Fri, 23 Sep 2016 16:05:21 +0000 (12:05 -0400)
committerKathy Lussier <klussier@masslnc.org>
Fri, 3 Mar 2017 14:38:21 +0000 (09:38 -0500)
The grid "Actions" menu is disabled until one or more rows are selected.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jeanette Lundgren <jlundgren@cwmars.org>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>

Open-ILS/src/templates/staff/share/t_autogrid.tt2
Open-ILS/web/js/ui/default/staff/services/grid.js

index 82fa3b2..acf3b5c 100644 (file)
@@ -86,7 +86,8 @@
 
     <!-- actions drop-down menu -->
     <div class="btn-group" ng-show="showActions" ng-if="actionGroups.length > 1 || actionGroups[0].actions.length" uib-dropdown>                                                  
-      <button type="button" class="btn btn-default" uib-dropdown-toggle>
+      <button type="button" class="btn btn-default" uib-dropdown-toggle
+        ng-disabled="!hasSelected()">
         [% l('Actions') %] <span class="caret"></span>                       
       </button>                                                              
       <ul class="pull-right grid-action-dropdown scrollable-menu" uib-dropdown-menu>
index 6c3e075..8828456 100644 (file)
@@ -127,6 +127,10 @@ angular.module('egGridMod',
                 $scope.actionGroups = [{actions:[]}]; // Grouped actions for selected items
                 $scope.menuItems = []; // global actions
 
+                // returns true if any rows are selected.
+                $scope.hasSelected = function() {
+                    return grid.getSelectedItems().length > 0 };
+
                 var features = ($scope.features) ? 
                     $scope.features.split(',') : [];
                 delete $scope.features;