webstaff: web staff: teach MARC editor how to work in-place
authorGalen Charlton <gmc@esilibrary.com>
Tue, 28 Jul 2015 15:00:16 +0000 (15:00 +0000)
committerJason Stephenson <jstephenson@mvlc.org>
Wed, 19 Aug 2015 17:39:19 +0000 (13:39 -0400)
This patch adds an "in-place" mode to the MARC editor for
cases where client-side MARC munging is needed without
immediately saving the results to the database.

To use, include in-place-mode="true" in the eg-marc-edit-record
directive.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js

index ddd469c..8f52306 100644 (file)
@@ -428,7 +428,11 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap'])
         scope: {
             dirtyFlag : '=',
             recordId : '=',
-            marcXml : '@',
+            marcXml : '=',
+            // in-place mode means that the editor is being
+            // used just to munge some MARCXML client-side, rather
+            // than to (immediately) update the database
+            inPlaceMode : '@',
             recordType : '@',
             maxUndo : '@'
         },
@@ -931,6 +935,10 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap'])
                 };
 
                 $scope.saveRecord = function () {
+                    if ($scope.inPlaceMode) {
+                        $scope.marcXml = $scope.record.toXmlString();
+                        return;
+                    }
                     $scope.mangle_005();
                     $scope.Record().editor(egCore.auth.user().id());
                     $scope.Record().edit_date('now');