From 97816457a066c80ac4fbac806e0e5a9293188a4d Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Thu, 10 Dec 2015 18:17:24 -0500 Subject: [PATCH] start on a config editor for config.copy_alert_types Signed-off-by: Galen Charlton --- Open-ILS/src/templates/staff/admin/local/index.tt2 | 6 +++ .../templates/staff/admin/local/t_grid_editor.tt2 | 12 ++++++ .../web/js/ui/default/staff/admin/local/app.js | 46 +++++++++++++++++++++- 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 Open-ILS/src/templates/staff/admin/local/t_grid_editor.tt2 diff --git a/Open-ILS/src/templates/staff/admin/local/index.tt2 b/Open-ILS/src/templates/staff/admin/local/index.tt2 index 02d604f887..6200f6efc9 100644 --- a/Open-ILS/src/templates/staff/admin/local/index.tt2 +++ b/Open-ILS/src/templates/staff/admin/local/index.tt2 @@ -7,8 +7,14 @@ [% BLOCK APP_JS %] + + diff --git a/Open-ILS/src/templates/staff/admin/local/t_grid_editor.tt2 b/Open-ILS/src/templates/staff/admin/local/t_grid_editor.tt2 new file mode 100644 index 0000000000..54f3da031d --- /dev/null +++ b/Open-ILS/src/templates/staff/admin/local/t_grid_editor.tt2 @@ -0,0 +1,12 @@ + + + + + + diff --git a/Open-ILS/web/js/ui/default/staff/admin/local/app.js b/Open-ILS/web/js/ui/default/staff/admin/local/app.js index afceb4da76..016beb93d1 100644 --- a/Open-ILS/web/js/ui/default/staff/admin/local/app.js +++ b/Open-ILS/web/js/ui/default/staff/admin/local/app.js @@ -1,5 +1,5 @@ angular.module('egLocalAdmin', - ['ngRoute', 'ui.bootstrap', 'egCoreMod','egUiMod']) + ['ngRoute', 'ui.bootstrap', 'egCoreMod','egUiMod','egGridMod']) .config(['$routeProvider','$locationProvider','$compileProvider', function($routeProvider , $locationProvider , $compileProvider) { @@ -51,6 +51,12 @@ angular.module('egLocalAdmin', resolve : resolver }); + $routeProvider.when('/admin/local/config/copy_alert_types', { + templateUrl: './admin/local/t_grid_editor', + controller: 'AutoGridEditorCtl', + fmBase: 'ccat' + }); + // Conify page handler $routeProvider.when('/admin/local/:schema/:page', { template: eframe_template, @@ -105,3 +111,41 @@ function($scope , $location , egCore , $timeout) { $scope.local_admin_url = $location.absUrl().replace(/\/.*/, url); }]) +.controller('AutoGridEditorCtl', + ['$scope','$route','$location','egCore','$timeout','egConfirmDialog','$modal', +function($scope , $route , $location , egCore , $timeout , egConfirmDialog , $modal) { + + $scope.funcs = {}; + + $scope.baseFmClass = $route.current.$$route.fmBase; + $scope.gridControls = { + setQuery : function(q) { + if (q) query = q; + return query; + } + }; + $scope.gridControls.setQuery({id : {'!=' : null}}); + + $scope.createHandler = function() { + }; + $scope.editHandler = function(items) { + }; + $scope.deleteHandler = function(items) { + egConfirmDialog.open( + egCore.strings.REMOVE_ITEM_CONFIRM, + '', + {} + ).result.then(function() { + var ids = items.map(function(s){ return s.id }); + egCore.pcrud.search( + $scope.baseFmClass, {id : ids}, {}, + {atomic : true, authoritative : true} + ).then(function(to_delete) { + return egCore.pcrud.remove(to_delete); + }).then(function() { + $scope.gridControls.refresh(); + }); + }); + }; +}]) + -- 2.11.0