From f905064514dfabcbf20cecacd2019b26848e57fd Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Mon, 5 Oct 2015 22:02:44 +0000 Subject: [PATCH] webstaff: teach the merge record dialog how to edit volumes This adds an "edit volumes" button under each record in the merge records interface that opens a modal embedding the volume editor. The embedding is done via an iframe in lieu of splitting the relevant bits of the volume/copy editor into an independent service. Signed-off-by: Galen Charlton Signed-off-by: Kathy Lussier --- .../staff/cat/bucket/record/index.tt2 | 1 + .../staff/cat/share/t_embedded_volcopy.tt2 | 14 ++++++ .../staff/cat/share/t_volume_list.tt2 | 4 +- .../ui/default/staff/cat/services/holdings.js | 43 ++++++++++++++++++- 4 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 Open-ILS/src/templates/staff/cat/share/t_embedded_volcopy.tt2 diff --git a/Open-ILS/src/templates/staff/cat/bucket/record/index.tt2 b/Open-ILS/src/templates/staff/cat/bucket/record/index.tt2 index 82d087b2f4..24b5ac98a1 100644 --- a/Open-ILS/src/templates/staff/cat/bucket/record/index.tt2 +++ b/Open-ILS/src/templates/staff/cat/bucket/record/index.tt2 @@ -8,6 +8,7 @@ [% BLOCK APP_JS %] + diff --git a/Open-ILS/src/templates/staff/cat/share/t_embedded_volcopy.tt2 b/Open-ILS/src/templates/staff/cat/share/t_embedded_volcopy.tt2 new file mode 100644 index 0000000000..4c704d7f99 --- /dev/null +++ b/Open-ILS/src/templates/staff/cat/share/t_embedded_volcopy.tt2 @@ -0,0 +1,14 @@ +
+ + + +
diff --git a/Open-ILS/src/templates/staff/cat/share/t_volume_list.tt2 b/Open-ILS/src/templates/staff/cat/share/t_volume_list.tt2 index db77586091..56f1c0728f 100644 --- a/Open-ILS/src/templates/staff/cat/share/t_volume_list.tt2 +++ b/Open-ILS/src/templates/staff/cat/share/t_volume_list.tt2 @@ -1,10 +1,12 @@ + + diff --git a/Open-ILS/web/js/ui/default/staff/cat/services/holdings.js b/Open-ILS/web/js/ui/default/staff/cat/services/holdings.js index 74ba520564..0bebe6cf31 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/services/holdings.js +++ b/Open-ILS/web/js/ui/default/staff/cat/services/holdings.js @@ -281,8 +281,8 @@ function(egCore , $q) { }, templateUrl: './cat/share/t_volume_list', controller: - ['$scope','holdingsSvc','egCore','egGridDataProvider', - function($scope , holdingsSvc , egCore , egGridDataProvider) { + ['$scope','holdingsSvc','egCore','egGridDataProvider','$modal', + function($scope , holdingsSvc , egCore , egGridDataProvider, $modal) { var holdingsSvcInst = new holdingsSvc(); $scope.holdingsGridControls = {}; @@ -291,6 +291,45 @@ function(egCore , $q) { return this.arrayNotifier(holdingsSvcInst.copies, offset, count); } }); + + function gatherHoldingsIds () { + var cp_id_list = []; + angular.forEach( + $scope.holdingsGridControls.allItems(), + function (item) { cp_id_list = cp_id_list.concat(item.id_list) } + ); + return cp_id_list; + } + + $scope.edit_volumes = function () { + egCore.net.request( + 'open-ils.actor', + 'open-ils.actor.anon_cache.set_value', + null, 'edit-these-copies', { + record_id: $scope.recordId, + copies: gatherHoldingsIds(), + hide_vols : false, + hide_copies : true + } + ).then(function(key) { + if (key) { + $modal.open({ + templateUrl: './cat/share/t_embedded_volcopy', + size: 'lg', + controller: + ['$scope', '$modalInstance', function($scope, $modalInstance) { + $scope.volcopy_url = + egCore.env.basePath + 'cat/volcopy/' + key + '/embedded'; + $scope.ok = function(args) { $modalInstance.close(args) } + $scope.cancel = function () { $modalInstance.dismiss() } + }] + }).result.then(function() { + load_holdings(); + }); + } + }); + } + function load_holdings() { holdingsSvcInst.fetch({ rid : $scope.recordId, -- 2.43.2