From bc2713b733da00427932d1be1a562349dccdd945 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Fri, 4 Sep 2015 08:47:03 -0400 Subject: [PATCH] webstaff: Enable Fast Item Add functionality in the MARC editor, and improve button layout Signed-off-by: Mike Rylander Signed-off-by: Galen Charlton Signed-off-by: Jason Stephenson --- .../src/templates/staff/cat/share/t_marcedit.tt2 | 56 ++++++++++++++-------- .../js/ui/default/staff/cat/services/marcedit.js | 56 ++++++++++++++++++++-- .../web/js/ui/default/staff/cat/volcopy/app.js | 1 + 3 files changed, 89 insertions(+), 24 deletions(-) diff --git a/Open-ILS/src/templates/staff/cat/share/t_marcedit.tt2 b/Open-ILS/src/templates/staff/cat/share/t_marcedit.tt2 index eef0f6a336..eba2c17997 100644 --- a/Open-ILS/src/templates/staff/cat/share/t_marcedit.tt2 +++ b/Open-ILS/src/templates/staff/cat/share/t_marcedit.tt2 @@ -1,34 +1,48 @@
-
- - - +
+
+ +
+
+ +
+
+ +
-
+
- - +
- - {{calculated_record_type}} +
+ [% l('Record Type') %] + {{calculated_record_type}} +
-
- -
-
- -
-
- -
-
- - +
+
+ + + + + + + + + + + + + +
diff --git a/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js b/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js index 119644d5b5..056c34e5c4 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js +++ b/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js @@ -502,11 +502,14 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) }); }, - controller : ['$timeout','$scope','$q','egCore', 'egTagTable', - function ( $timeout , $scope , $q, egCore , egTagTable ) { + controller : ['$timeout','$scope','$q','$window','egCore', 'egTagTable', + function ( $timeout , $scope , $q, $window , egCore , egTagTable ) { MARC21.Record.delimiter = '$'; + $scope.enable_fast_add = false; + $scope.fast_item_callnumber = ''; + $scope.fast_item_barcode = ''; $scope.flatEditor = false; $scope.brandNewRecord = false; $scope.bib_source = null; @@ -1044,7 +1047,30 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) if ($scope.recordId) { return egCore.pcrud.update( $scope.Record() - ).then(loadRecord); + ).then(function() { + if ($scope.enable_fast_add) { + egCore.net.request( + 'open-ils.actor', + 'open-ils.actor.anon_cache.set_value', + null, 'edit-these-copies', { + record_id: $scope.recordId, + raw: [{ + label : $scope.fast_item_callnumber, + barcode : $scope.fast_item_barcode, + }], + hide_vols : false, + hide_copies : false + } + ).then(function(key) { + if (key) { + var url = egCore.env.basePath + 'cat/volcopy/' + key; + $timeout(function() { $window.open(url, '_blank') }); + } else { + alert('Could not create anonymous cache key!'); + } + }); + } + }).then(loadRecord); } else { $scope.Record().creator(egCore.auth.user().id()); $scope.Record().create_date('now'); @@ -1052,8 +1078,32 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) $scope.Record() ).then(function(bre) { $scope.recordId = bre.id(); + if ($scope.enable_fast_add) { + egCore.net.request( + 'open-ils.actor', + 'open-ils.actor.anon_cache.set_value', + null, 'edit-these-copies', { + record_id: $scope.recordId, + raw: [{ + label : $scope.fast_item_callnumber, + barcode : $scope.fast_item_barcode, + }], + hide_vols : false, + hide_copies : false + } + ).then(function(key) { + if (key) { + var url = egCore.env.basePath + 'cat/volcopy/' + key; + $timeout(function() { $window.open(url, '_blank') }); + } else { + alert('Could not create anonymous cache key!'); + } + }); + } }).then(loadRecord); } + + }; $scope.seeBreaker = function () { diff --git a/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js b/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js index 8cd4b78fcb..0a3bafaa49 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js @@ -809,6 +809,7 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , return itemSvc.fetchIds(data.copies); if (data.raw && data.raw.length) { + $scope.dirty = true; /* data.raw data structure looks like this: * [{ -- 2.11.0