From 19ce00f906a59d8acc0d9290d539927cf2499613 Mon Sep 17 00:00:00 2001 From: Galen Charlton <gmc@esilibrary.com> Date: Tue, 6 Oct 2015 18:24:16 +0000 Subject: [PATCH] webstaff: teach MARC editor some more tricks [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 | 10 +++++----- Open-ILS/src/templates/staff/css/cat.css.tt2 | 4 ++++ Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js | 4 +++- 3 files changed, 12 insertions(+), 6 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 f41595081f..808438f61c 100644 --- a/Open-ILS/src/templates/staff/cat/share/t_marcedit.tt2 +++ b/Open-ILS/src/templates/staff/cat/share/t_marcedit.tt2 @@ -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') %] @@ -30,13 +30,13 @@ <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"> diff --git a/Open-ILS/src/templates/staff/css/cat.css.tt2 b/Open-ILS/src/templates/staff/css/cat.css.tt2 index 4faae17cab..7a5e12dcae 100644 --- a/Open-ILS/src/templates/staff/css/cat.css.tt2 +++ b/Open-ILS/src/templates/staff/css/cat.css.tt2 @@ -12,6 +12,10 @@ //background-color: #f5f5f5; } +.marcflateditor { + max-width: 100%; +} + .marcfastitemadd, .marctypesource { border-bottom: solid thin gray; } 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 cb978f32b6..b32f80e159 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 @@ -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'; -- 2.11.0