LP1670457 Action Menu Grid Selection Change
authorZavier Banks <zbanks@catalyte.io>
Thu, 5 Mar 2020 16:19:49 +0000 (16:19 +0000)
committerJason Boyer <JBoyer@EquinoxInitiative.org>
Mon, 15 Feb 2021 19:43:46 +0000 (14:43 -0500)
I reworked the grid to disable certain actions, if
an item was needed. However, if there were actions, were
there was no item needed, they would still be available.

Signed-off-by: Zavier Banks <zbanks@catalyte.io>
Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Signed-off-by: Jason Boyer <JBoyer@EquinoxInitiative.org>
Open-ILS/src/templates/staff/share/t_autogrid.tt2
Open-ILS/web/js/ui/default/staff/services/grid.js

index 38e9a00..1ded8b7 100644 (file)
@@ -92,8 +92,7 @@
 
     <!-- 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
-        ng-disabled="!hasSelected()">
+      <button type="button" class="btn btn-default" uib-dropdown-toggle>
         [% l('Actions') %] <span class="caret"></span>                       
       </button>                                                              
       <ul class="pull-right grid-action-dropdown scrollable-menu" uib-dropdown-menu>
index ce84caa..57d93c8 100644 (file)
@@ -658,6 +658,9 @@ angular.module('egGridMod',
 
             // fires the disable handler function for a context action
             $scope.actionDisable = function(action) {
+                if(grid.getSelectedItems().length == 0 && action.handler.length > 0) {
+                    return true;
+                }
                 if (typeof action.disabled == 'undefined') {
                     return false;
                 }