From 393373cc1509d8e4b0056b42c2ab9397571072fe Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 11 Dec 2019 16:44:29 -0500 Subject: [PATCH] LP1852782 Tag menu static additions Adds support for add 006/007/008, delete fields and optionally add new field before and after actions to the context menus displayed for control field and data field tags. Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg --- .../context-menu-container.component.html | 17 ++++-- .../context-menu/context-menu.service.ts | 5 +- .../marc-edit/editable-content.component.html | 11 ++++ .../marc-edit/editable-content.component.ts | 59 ++++++++++++++++++- 4 files changed, 81 insertions(+), 11 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/share/context-menu/context-menu-container.component.html b/Open-ILS/src/eg2/src/app/share/context-menu/context-menu-container.component.html index 9a302883f7..b25f2cf356 100644 --- a/Open-ILS/src/eg2/src/app/share/context-menu/context-menu-container.component.html +++ b/Open-ILS/src/eg2/src/app/share/context-menu/context-menu-container.component.html @@ -1,10 +1,15 @@ - -
- + +
+ + + + + + +
diff --git a/Open-ILS/src/eg2/src/app/share/context-menu/context-menu.service.ts b/Open-ILS/src/eg2/src/app/share/context-menu/context-menu.service.ts index 838274b388..cd9470015b 100644 --- a/Open-ILS/src/eg2/src/app/share/context-menu/context-menu.service.ts +++ b/Open-ILS/src/eg2/src/app/share/context-menu/context-menu.service.ts @@ -5,8 +5,9 @@ import {tap} from 'rxjs/operators'; * template container component */ export interface ContextMenuEntry { - value: string; - label: string; + value?: string; + label?: string; + divider?: boolean; } export class ContextMenu { diff --git a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editable-content.component.html b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editable-content.component.html index 5dd8c2996c..07b67767a6 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editable-content.component.html +++ b/Open-ILS/src/eg2/src/app/staff/share/marc-edit/editable-content.component.html @@ -1,4 +1,15 @@ + + + + + + + +
0 || !this.add006Str) { + return this.tagMenuEntries; + } + + this.tagMenuEntries.push( + {label: this.add006Str.text, value: '_add006'}, + {label: this.add007Str.text, value: '_add007'}, + {label: this.add008Str.text, value: '_add008'} + ); + + if (!this.field.isCtrlField) { + this.tagMenuEntries.push( + {label: this.insertAfterStr.text, value: '_insertAfter'}, + {label: this.insertBeforeStr.text, value: '_insertBefore'} + ); + } + + this.tagMenuEntries.push( + {label: this.deleteFieldStr.text, value: '_deleteField'}, + {divider: true} + ); + + this.tagTable.getFieldTags().forEach(e => this.tagMenuEntries.push(e)); + + return this.tagMenuEntries; + } + getContent(): string { if (this.fieldText) { return this.fieldText; } // read-only @@ -538,6 +579,18 @@ export class EditableContentComponent } contextMenuChange(value: string) { + + switch (value) { + case '_add006': return this.context.add00X('006'); + case '_add007': return this.context.add00X('007'); + case '_add008': return this.context.insertReplace008(); + case '_insertBefore': + return this.context.insertStubField(this.field, true); + case '_insertAfter': + return this.context.insertStubField(this.field); + case '_deleteField': return this.context.deleteField(this.field); + } + this.setContent(value, true); // Context menus can steal focus. -- 2.43.2