webstaff: teach MARC editor some more tricks
authorGalen Charlton <gmc@esilibrary.com>
Tue, 6 Oct 2015 18:24:16 +0000 (18:24 +0000)
committerKathy Lussier <klussier@masslnc.org>
Tue, 2 Feb 2016 19:58:49 +0000 (14:58 -0500)
[1] Now accepts a flat-only attribute specifying that
    the editor should be restricted to flat mode.
[2] Now accepts an embedded attribute specifying that
    various stuff that isn't useful when the editor
    is embedded in another control should be ignored.
[3] The width of the flat editor's textarea is now
    bounded by its container.

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/css/cat.css.tt2
Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js

index f415950..808438f 100644 (file)
@@ -1,5 +1,5 @@
 <div>
-  <div ng-show="bre" class="row pad-vert marcfastitemadd" ng-hide="brandNewRecord">
+  <div ng-show="bre && !(brandNewRecord || embedded)" class="row pad-vert marcfastitemadd">
     <div class="col-md-2">
       <label><input type="checkbox" ng-model="enable_fast_add"/> [% l('Add Item') %]</label>
     </div>
@@ -12,7 +12,7 @@
   </div>
 
   <div class="pad-vert row marctypesource">
-    <div class="col-md-2">
+    <div class="col-md-2" ng-show="!flatOnly">
       <label>
         <input type="checkbox" ng-model="flatEditor" ng-change="refreshVisual()"/>
         [% l('Flat Text Editor') %]
     <div class="col-md-3">
       <div class="btn-group">
         <span class="btn-group">
-          <button class="btn btn-default" ng-show="record_type == 'bre'" ng-click="validateHeadings()">[% l('Validate') %]</button>
+          <button class="btn btn-default" ng-show="record_type == 'bre' && !flatOnly" ng-click="validateHeadings()">[% l('Validate') %]</button>
         </span>
         <span class="btn-group">
           <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>
+          <button ng-hide="brandNewRecord || embedded || Record().deleted()" class="btn btn-default" ng-click="deleteRecord()">[% l('Delete') %]</button>
           <button ng-if="!brandNewRecord && Record().deleted()" class="btn btn-default" ng-click="undeleteRecord()">[% l('Undelete') %]</button>
         </span>
       </div>
@@ -44,7 +44,7 @@
   </div>
 
   <div ng-show="flatEditor">
-    <textarea cols="120" rows="40" ng-model="flat_text_marc" ng-blur="saveFlatTextMARC()"></textarea>
+    <textarea class="marcflateditor" cols="120" rows="40" ng-model="flat_text_marc" ng-blur="saveFlatTextMARC()"></textarea>
   </div>
   <div ng-show="!flatEditor">
     <div class="row pad-vert">
index 4faae17..7a5e12d 100644 (file)
     //background-color: #f5f5f5;
 }
 
+.marcflateditor {
+    max-width: 100%;
+}
+
 .marcfastitemadd, .marctypesource {
     border-bottom: solid thin gray;
 }
index cb978f3..b32f80e 100644 (file)
@@ -581,6 +581,8 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap'])
             // used just to munge some MARCXML client-side, rather
             // than to (immediately) update the database
             inPlaceMode : '@',
+            flatOnly : '@',
+            embedded : '@',
             recordType : '@',
             maxUndo : '@',
             saveLabel : '@'
@@ -620,7 +622,7 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap'])
                 $scope.enable_fast_add = false;
                 $scope.fast_item_callnumber = '';
                 $scope.fast_item_barcode = '';
-                $scope.flatEditor = false;
+                $scope.flatEditor = $scope.flatOnly ? true : false;
                 $scope.brandNewRecord = false;
                 $scope.bib_source = null;
                 $scope.record_type = $scope.recordType || 'bre';