From 1e3c4725d7ae42cba16680b4dfb844eef87afcdb Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 21 Apr 2017 16:13:44 -0400 Subject: [PATCH] webstaff: changes to subscription management form - adjust layout and styling to be a bit more compact - add cancel/reset button - save button now active only when form is dirty Signed-off-by: Galen Charlton --- Open-ILS/src/templates/staff/serials/t_manage.tt2 | 45 +++++++++++------------ Open-ILS/web/js/ui/default/staff/serials/app.js | 20 +++++++--- 2 files changed, 37 insertions(+), 28 deletions(-) diff --git a/Open-ILS/src/templates/staff/serials/t_manage.tt2 b/Open-ILS/src/templates/staff/serials/t_manage.tt2 index 566054c495..702975d5d8 100644 --- a/Open-ILS/src/templates/staff/serials/t_manage.tt2 +++ b/Open-ILS/src/templates/staff/serials/t_manage.tt2 @@ -9,43 +9,46 @@ otherwise selecting the active table won't work cleanly --> -
+
-
-
+
+
-
-
+
-
+
-
+
-
+
-
+
+
-
+
-
+
-
-
+ +
- +
@@ -55,19 +58,15 @@
-
- - -
- - + +
+ + +
diff --git a/Open-ILS/web/js/ui/default/staff/serials/app.js b/Open-ILS/web/js/ui/default/staff/serials/app.js index 5c6510cdec..76de65a1b8 100644 --- a/Open-ILS/web/js/ui/default/staff/serials/app.js +++ b/Open-ILS/web/js/ui/default/staff/serials/app.js @@ -46,6 +46,13 @@ function($scope , $routeParams , $location , $window , $q , egSerialsCoreSvc , e } }); + function reload() { + egSerialsCoreSvc.fetch($scope.bib_id).then(function() { + $scope.subscriptions = egCore.idl.toTypedHash(egSerialsCoreSvc.subTree); + $scope.distStreamGridDataProvider.refresh(); + }); + } + $scope.add_subscription = function() { var new_ssub = egCore.idl.toTypedHash(new egCore.idl.ssub()); new_ssub._isnew = true; @@ -70,7 +77,12 @@ function($scope , $routeParams , $location , $window , $q , egSerialsCoreSvc , e } sdist.streams.push(new_sstr); } - $scope.save_subscriptions = function() { + + $scope.abort_changes = function(form) { + reload(); + form.$setPristine(); + } + $scope.save_subscriptions = function(form) { // traverse through structure and set _ischanged // TODO add more granular dirty input detection angular.forEach($scope.subscriptions, function(ssub) { @@ -126,10 +138,8 @@ function($scope , $routeParams , $location , $window , $q , egSerialsCoreSvc , e }); }); $q.all(promises).then(function(resolutions) { - egSerialsCoreSvc.fetch($scope.bib_id).then(function() { - $scope.subscriptions = egCore.idl.toTypedHash(egSerialsCoreSvc.subTree); - $scope.distStreamGridDataProvider.refresh(); - }); + reload(); + form.$setPristine(); }); } }]) -- 2.11.0