From 6ff052096c594a7e95041619914600950bfdf87a Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Fri, 6 Mar 2015 15:54:16 -0500 Subject: [PATCH] webstaff: Teach autogrid about grouping Actions menu options Signed-off-by: Mike Rylander Signed-off-by: Galen Charlton Signed-off-by: Jason Stephenson --- .../src/templates/staff/share/t_autogrid.tt2 | 8 ++++++-- .../web/js/ui/default/staff/services/grid.js | 18 ++++++++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/templates/staff/share/t_autogrid.tt2 b/Open-ILS/src/templates/staff/share/t_autogrid.tt2 index 03aa65e192..86f27234ec 100644 --- a/Open-ILS/src/templates/staff/share/t_autogrid.tt2 +++ b/Open-ILS/src/templates/staff/share/t_autogrid.tt2 @@ -65,15 +65,19 @@ -
+
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 2c1a482e69..68c996f4cf 100644 --- a/Open-ILS/web/js/ui/default/staff/services/grid.js +++ b/Open-ILS/web/js/ui/default/staff/services/grid.js @@ -106,7 +106,7 @@ angular.module('egGridMod', $scope.showGridConf = false; grid.totalCount = -1; $scope.selected = {}; - $scope.actions = []; // actions for selected items + $scope.actionGroups = [{actions:[]}]; // Grouped actions for selected items $scope.menuItems = []; // global actions // remove some unneeded values from the scope to reduce bloat @@ -280,7 +280,19 @@ angular.module('egGridMod', // add a selected-items action grid.addAction = function(act) { - $scope.actions.push(act); + var done = false; + $scope.actionGroups.forEach(function(g){ + if (g.label === act.group) { + g.actions.push(act); + done = true; + } + }); + if (!done) { + $scope.actionGroups.push({ + label : act.group, + actions : [ act ] + }); + } } // remove the stored column configuration preferenc, then recover @@ -972,6 +984,7 @@ angular.module('egGridMod', restrict : 'AE', transclude : true, scope : { + group : '@', // Action group, ungrouped if not set label : '@', // Action label handler : '=', // Action function handler hide : '=', @@ -980,6 +993,7 @@ angular.module('egGridMod', link : function(scope, element, attrs, egGridCtrl) { egGridCtrl.addAction({ hide : scope.hide, + group : scope.group, label : scope.label, divider : scope.divider, handler : scope.handler -- 2.43.2