From 6bc0189e5cbeae26bb90ad83a8d9cd1825cc4e0f Mon Sep 17 00:00:00 2001 From: Jane Sandberg Date: Wed, 26 Aug 2020 15:51:32 -0700 Subject: [PATCH] LP1849212: Improvements to the Simplified Marc Editor * Templates can now set multiple subfields for the same field * Templates can now set indicator values * Editor now allows user to choose a MARC Form and Type * Improvements to the course associate brief record interface to use these improvements Signed-off-by: Jane Sandberg Signed-off-by: Michele Morgan Signed-off-by: Galen Charlton --- .../course-associate-material.component.html | 24 ++++-- .../eg2/src/app/staff/share/course.service.ts | 6 +- .../simplified-editor-field.component.ts | 42 ---------- .../simplified-editor-field.directive.ts | 60 ++++++++++++++ .../simplified-editor-subfield.directive.ts | 23 ++++++ .../simplified-editor.component.html | 36 ++++++--- .../simplified-editor.component.ts | 80 ++++++++++++++++--- .../simplified-editor.module.ts | 9 ++- 8 files changed, 206 insertions(+), 74 deletions(-) delete mode 100644 Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor-field.component.ts create mode 100644 Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor-field.directive.ts create mode 100644 Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor-subfield.directive.ts diff --git a/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-associate-material.component.html b/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-associate-material.component.html index 73e5bddc46..9d94b30d51 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-associate-material.component.html +++ b/Open-ILS/src/eg2/src/app/staff/admin/local/course-reserves/course-associate-material.component.html @@ -162,13 +162,21 @@ placeholder="e.g. Required" class="flex-grow-1" /> - - - - - - + + + + + + + + + + + + + @@ -210,7 +218,7 @@
- + diff --git a/Open-ILS/src/eg2/src/app/staff/share/course.service.ts b/Open-ILS/src/eg2/src/app/staff/share/course.service.ts index bc7f707359..7443a79c2d 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/course.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/course.service.ts @@ -30,10 +30,12 @@ export class CourseService { getCourses(course_ids?: Number[]): Promise { if (!course_ids) { return this.pcrud.retrieveAll('acmc', - {}, {atomic: true}).toPromise(); + {flesh: 1, flesh_fields: {'acmc': ['owning_lib']}}, + {atomic: true}).toPromise(); } else { return this.pcrud.search('acmc', {id: course_ids}, - {}, {atomic: true}).toPromise(); + {flesh: 1, flesh_fields: {'acmc': ['owning_lib']}}, + {atomic: true}).toPromise(); } } diff --git a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor-field.component.ts b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor-field.component.ts deleted file mode 100644 index bfed188b22..0000000000 --- a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor-field.component.ts +++ /dev/null @@ -1,42 +0,0 @@ -import {Component, Host, Input, OnInit} from '@angular/core'; -import {MarcSimplifiedEditorComponent} from './simplified-editor.component'; -import {MarcSubfield} from '../marcrecord'; - -/** - * A field that a user can edit, which will later be - * compiled into MARC - */ - -@Component({ - selector: 'eg-marc-simplified-editor-field', - template: '' -}) -export class MarcSimplifiedEditorFieldComponent implements OnInit { - - @Input() tag: string; - @Input() subfield: string; - @Input() defaultValue: string; - - constructor(@Host() private editor: MarcSimplifiedEditorComponent) {} - - ngOnInit() { - this.editor.addField({ - tag: this.tag, - subfields: [[ - this.subfield, - this.defaultValue ? this.defaultValue : '', - 0 - ]], - authValid: false, - authChecked: false, - isCtrlField: false, - isControlfield: () => false, - indicator: (ind: number) => '0', - deleteExactSubfields: (...subfield: MarcSubfield[]) => 0, - }); - } - -} - - - diff --git a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor-field.directive.ts b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor-field.directive.ts new file mode 100644 index 0000000000..a5e7e0a76f --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor-field.directive.ts @@ -0,0 +1,60 @@ +import {Directive, Host, Input, OnInit, AfterViewInit} from '@angular/core'; +import {MarcSimplifiedEditorComponent} from './simplified-editor.component'; +import {MarcField, MarcSubfield} from '../marcrecord'; +import {MarcSimplifiedEditorSubfieldDirective} from './simplified-editor-subfield.directive'; + +/** + * A field that a user can edit, which will later be + * compiled into MARC + */ + +@Directive({ + selector: 'eg-marc-simplified-editor-field', +}) +export class MarcSimplifiedEditorFieldDirective implements OnInit, AfterViewInit { + + @Input() tag = 'a'; + @Input() ind1 = ' '; + @Input() ind2 = ' '; + + subfieldIndex = 1; + + marcVersion: MarcField; + + addSubfield: (code: string, defaultValue?: string) => void; + + constructor(@Host() private editor: MarcSimplifiedEditorComponent) {} + + ngOnInit() { + this.marcVersion = { + tag: this.tag, + subfields: [], + authValid: false, + authChecked: false, + isCtrlField: false, + isControlfield: () => false, + indicator: (ind: number) => (ind === 1) ? this.ind1 : this.ind2, + deleteExactSubfields: (...subfield: MarcSubfield[]) => 0, // not used by the simplified editor + }; + + this.addSubfield = (code: string, defaultValue?: string) => { + this.marcVersion.subfields.push( + [ + code, + defaultValue ? defaultValue : '', + this.subfieldIndex + ] + ); + this.subfieldIndex += 1; + + } + } + + ngAfterViewInit() { + this.editor.addField(this.marcVersion); + } + +} + + + diff --git a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor-subfield.directive.ts b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor-subfield.directive.ts new file mode 100644 index 0000000000..d9474a85c5 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor-subfield.directive.ts @@ -0,0 +1,23 @@ +import {Directive, Input, Host, OnInit} from '@angular/core'; +import {MarcSimplifiedEditorFieldDirective} from './simplified-editor-field.directive'; + +/** + * A subfield that a user can edit, which will later be + * compiled into MARC + */ + +@Directive({ + selector: 'eg-marc-simplified-editor-subfield', +}) +export class MarcSimplifiedEditorSubfieldDirective implements OnInit { + + @Input() code: string; + @Input() defaultValue: string; + + constructor(@Host() private field: MarcSimplifiedEditorFieldDirective) {} + + ngOnInit() { + this.field.addSubfield(this.code, this.defaultValue); + } + +} diff --git a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor.component.html b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor.component.html index a82dbf3b9d..50ce7b63f9 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor.component.html +++ b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/simplified-editor/simplified-editor.component.html @@ -1,15 +1,31 @@ - +
+
+
Form
+
+ + + +
+
+
+
Type
+
+ +
+
-
-
- -
-
- -
+
+ +
+ +
+
+ +
+