From b9d336057b1312be480ffe0185e9aa09586cea2a Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Mon, 22 Jun 2015 13:16:19 -0400 Subject: [PATCH] webstaff: Teach grids how to provide checkboxes Signed-off-by: Mike Rylander Signed-off-by: Galen Charlton Signed-off-by: Jason Stephenson --- Open-ILS/src/templates/staff/share/t_autogrid.tt2 | 23 +++++++++++++++++------ Open-ILS/web/js/ui/default/staff/services/grid.js | 14 ++++++++++++++ 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/Open-ILS/src/templates/staff/share/t_autogrid.tt2 b/Open-ILS/src/templates/staff/share/t_autogrid.tt2 index 6732e8d303..0b8779d5e8 100644 --- a/Open-ILS/src/templates/staff/share/t_autogrid.tt2 +++ b/Open-ILS/src/templates/staff/share/t_autogrid.tt2 @@ -10,7 +10,7 @@
- - @@ -29,12 +29,23 @@
- +
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 c98107566d..a3626e8cf5 100644 --- a/Open-ILS/web/js/ui/default/staff/services/grid.js +++ b/Open-ILS/web/js/ui/default/staff/services/grid.js @@ -265,6 +265,16 @@ angular.module('egGridMod', grid.controls = controls; } + // If a menu item provides its own HTML template, translate it, + // using the menu item for the template scope. + // note: $sce is required to avoid security restrictions and + // is OK here, since the template comes directly from a + // local HTML template (not user input). + $scope.translateMenuItemTemplate = function(item) { + var html = egCore.strings.$replace(item.template, {item : item}); + return $sce.trustAsHtml(html); + } + // add a new (global) grid menu item grid.addMenuItem = function(item) { $scope.menuItems.push(item); @@ -1603,6 +1613,8 @@ angular.module('egGridMod', require : '^egGrid', scope : { label : '@', + checkbox : '@', + checked : '=', standalone : '=', handler : '=', // onclick handler function divider : '=', // if true, show a divider only @@ -1612,6 +1624,8 @@ angular.module('egGridMod', }, link : function(scope, element, attrs, egGridCtrl) { egGridCtrl.addMenuItem({ + checkbox : scope.checkbox, + checked : scope.checked ? true : false, label : scope.label, standalone : scope.standalone ? true : false, handler : scope.handler, -- 2.11.0