webstaff: give more feedback for Z39.50 edit-then-import
authorGalen Charlton <gmc@esilibrary.com>
Thu, 24 Sep 2015 20:52:50 +0000 (20:52 +0000)
committerKathy Lussier <klussier@masslnc.org>
Tue, 2 Feb 2016 19:58:46 +0000 (14:58 -0500)
The "edit then import" modal now varies the label of the
MARC editor's save button based on whether one has yet
to import the current record or if one is just making
changes to it after having imported it. The dialog now
also has a button for going to the newly-imported record
in catalog view.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/src/templates/staff/cat/share/t_marcedit.tt2
Open-ILS/src/templates/staff/cat/share/z3950_strings.tt2
Open-ILS/src/templates/staff/cat/z3950/t_marc_edit.tt2
Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js
Open-ILS/web/js/ui/default/staff/cat/z3950/app.js

index 4c1adbe..a487624 100644 (file)
@@ -47,7 +47,7 @@
           <button class="btn btn-default" ng-show="record_type == 'bre'" ng-click="validateHeadings()">[% l('Validate') %]</button>
         </span>
         <span class="btn-group">
-          <button class="btn btn-default" ng-click="saveRecord()">[% l('Save') %]</button>
+          <button class="btn btn-primary" ng-click="saveRecord()">{{ saveLabel || "[% l('Save') %]"}}</button>
         </span>
         <span class="btn-group">
           <button ng-hide="brandNewRecord || Record().deleted()" class="btn btn-default" ng-click="deleteRecord()">[% l('Delete') %]</button>
index 50cc1a7..7be4638 100644 (file)
@@ -6,5 +6,7 @@ angular.module('egCoreMod').run(['egStrings', function(s) {
     s.IMPORTED_RECORD_FROM_Z3950_AS_ID  = "[% l('Record imported as ID [_1]', '{{id}}') %]";
     s.GO_TO_RECORD                      = "[% l('Go to record') %]";
     s.GO_BACK                           = "[% l('Go back') %]";
+    s.IMPORT_BUTTON_LABEL               = "[% l('Import') %]";
+    s.SAVE_BUTTON_LABEL                 = "[% l('Save') %]";
 }]);
 </script>
index ab70dc9..9e0fe21 100644 (file)
@@ -6,10 +6,12 @@
   </div>
   <div class="modal-body">
     <eg-marc-edit-record dirty-flag="dirty_flag" record-id="record_id" marc-xml="marc_xml"
-                         record-type="bre"
+                         record-type="bre" save-label="{{save_label}}"
+                         on-save="import_record_callback"
     />
   </div>
   <div class="modal-footer">
+    <button class="btn btn-primary" ng-click="ok()" ng-disabled="!record_id">[% l('Go to imported record') %]</button>
     <button class="btn btn-warning" ng-click="cancel()">[% l('Cancel') %]</button>
   </div>
 </div>
index 64f4b4e..3ec54d6 100644 (file)
@@ -582,7 +582,8 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap'])
             // than to (immediately) update the database
             inPlaceMode : '@',
             recordType : '@',
-            maxUndo : '@'
+            maxUndo : '@',
+            saveLabel : '@'
         },
         link: function (scope, element, attrs) {
 
index 4cb33d3..85c0ac0 100644 (file)
@@ -251,20 +251,28 @@ function($scope , $q , $location , $timeout , $window,  egCore , egGridDataProvi
 
     $scope.spawn_editor = function() {
         var items = $scope.gridControls.selectedItems();
+        var recId = 0;
         $modal.open({
             templateUrl: './cat/z3950/t_marc_edit',
             size: 'lg',
             controller:
                 ['$scope', '$modalInstance', function($scope, $modalInstance) {
                 $scope.focusMe = true;
-                $scope.record_id = 0;
+                $scope.record_id = recId;
                 $scope.dirty_flag = false;
                 $scope.marc_xml = items[0]['marcxml'];
                 $scope.ok = function(args) { $modalInstance.close(args) }
                 $scope.cancel = function () { $modalInstance.dismiss() }
+                $scope.save_label = egCore.strings.IMPORT_BUTTON_LABEL;
+                $scope.import_record_callback = function (record_id) {
+                    recId = record_id;
+                    $scope.save_label = egCore.strings.SAVE_BUTTON_LABEL;
+                };
             }]
-        }).result.then(function (args) {
-            if (!args || !args.name) return;
+        }).result.then(function () {
+            if (recId) {
+                $window.location.href = egCore.env.basePath + 'cat/catalog/record/' + recId;
+            }
         });
     }