export class StringComponent implements OnInit {
+ // Storage key for future reference by the string service
@Input() key: string;
+
+ // Interpolation context
@Input() ctx: any;
+
+ // String template to interpolate
@Input() template: TemplateRef<any>;
+ // Static text -- no interpolation performed.
+ // This supersedes 'template'
+ @Input() text: string;
+
constructor(private elm: ElementRef, private strings: StringService) {
this.elm = elm;
this.strings = strings;
if (this.key) {
this.strings.register({
key: this.key,
- resolver: (ctx: any) => this.current(ctx)
+ resolver: (ctx: any) => {
+ if (this.text) {
+ // When passed text that does not require any
+ // interpolation, just return it as-is.
+ return Promise.resolve(this.text);
+ } else {
+ // Interpolate
+ return this.current(ctx);
+ }
+ }
});
}
}
-
// Apply the new context if provided, give our container a
// chance to update, then resolve with the current string.
// NOTE: talking to the native DOM element is not so great, but
import {ResultRecordComponent} from './result/record.component';
import {StaffCatalogService} from './catalog.service';
import {RecordPaginationComponent} from './record/pagination.component';
+import {RecordActionsComponent} from './record/actions.component';
import {MarcViewComponent} from './record/marc-view.component';
@NgModule({
ResultFacetsComponent,
ResultPaginationComponent,
RecordPaginationComponent,
+ RecordActionsComponent,
MarcViewComponent
],
imports: [
--- /dev/null
+
+<eg-string key="catalog.record.toast.conjoined"
+ i18n-text text="Conjoined Record Target Set"></eg-string>
+<eg-string key="catalog.record.toast.overlay"
+ i18n-text text="Record Overlay Target Set"></eg-string>
+<eg-string key="catalog.record.toast.holdTransfer"
+ i18n-text text="Hold Transfer Target Set"></eg-string>
+<eg-string key="catalog.record.toast.volumeTransfer"
+ i18n-text text="Volume Transfer Target Set"></eg-string>
+<eg-string key="catalog.record.toast.cleared"
+ text="Record Marks Cleared"></eg-string>
+
+<div class="row ml-0 mr-0">
+
+ <div ngbDropdown placement="bottom-right">
+ <button class="btn btn-primary" id="actionsForDd"
+ ngbDropdownToggle i18n>Mark For...</button>
+ <div ngbDropdownMenu aria-labelledby="actionsForDd">
+ <button class="dropdown-item" (click)="mark('conjoined')">
+ <span i18n>
+ Conjoined Items<ng-container *ngIf="targets.conjoined.current">
+ (Currently {{targets.conjoined.current}})</ng-container>
+ </span>
+ </button>
+ <button class="dropdown-item" (click)="mark('overlay')">
+ <span i18n>
+ Overlay Target<ng-container *ngIf="targets.overlay.current">
+ (Currently {{targets.overlay.current}})</ng-container>
+ </span>
+ </button>
+ <button class="dropdown-item" (click)="mark('holdTransfer')">
+ <span i18n>
+ Title Hold Transfer<ng-container *ngIf="targets.holdTransfer.current">
+ (Currently {{targets.holdTransfer.current}})</ng-container>
+ </span>
+ </button>
+ <button class="dropdown-item" (click)="mark('volumeTransfer')">
+ <span i18n>
+ Volume Transfer<ng-container *ngIf="targets.volumeTransfer.current">
+ (Currently {{targets.volumeTransfer.current}})</ng-container>
+ </span>
+ </button>
+ <button class="dropdown-item" (click)="clearMarks()">
+ <span i18n>Reset Record Marks</span>
+ </button>
+ </div>
+ </div>
+
+</div>
+
--- /dev/null
+import {Component, OnInit, Input} from '@angular/core';
+import {Router} from '@angular/router';
+import {StoreService} from '@eg/core/store.service';
+import {CatalogService} from '@eg/share/catalog/catalog.service';
+import {CatalogSearchContext} from '@eg/share/catalog/search-context';
+import {CatalogUrlService} from '@eg/share/catalog/catalog-url.service';
+import {StaffCatalogService} from '../catalog.service';
+import {StringService} from '@eg/share/string/string.service';
+import {ToastService} from '@eg/share/toast/toast.service';
+
+@Component({
+ selector: 'eg-catalog-record-actions',
+ templateUrl: 'actions.component.html'
+})
+export class RecordActionsComponent implements OnInit {
+
+ recId: number;
+ initDone = false;
+ searchContext: CatalogSearchContext;
+
+ targets = {
+ conjoined: {
+ key: 'eg.cat.marked_conjoined_record',
+ current: null
+ },
+ overlay: {
+ key: 'eg.cat.marked_overlay_record',
+ current: null
+ },
+ holdTransfer: {
+ key: 'eg.circ.hold.title_transfer_target',
+ current: null
+ },
+ volumeTransfer: {
+ key: 'eg.cat.marked_volume_transfer_record',
+ current: null
+ }
+ };
+
+ @Input() set recordId(recId: number) {
+ this.recId = recId
+ if (this.initDone) {
+ // Fire any record specific actions here
+ }
+ }
+
+ constructor(
+ private router: Router,
+ private store: StoreService,
+ private strings: StringService,
+ private toast: ToastService,
+ private cat: CatalogService,
+ private catUrl: CatalogUrlService,
+ private staffCat: StaffCatalogService,
+ ) {}
+
+ ngOnInit() {
+ this.initDone = true;
+
+ Object.keys(this.targets).forEach(name => {
+ const target = this.targets[name];
+ target.current = this.store.getLocalItem(target.key);
+ });
+ }
+
+ mark(name: string) {
+ const target = this.targets[name];
+ target.current = this.recId;
+ this.store.setLocalItem(target.key, this.recId);
+ this.strings.interpolate('catalog.record.toast.' + name)
+ .then(txt => this.toast.success(txt));
+ }
+
+ clearMarks() {
+ Object.keys(this.targets).forEach(name => {
+ const target = this.targets[name];
+ target.current = null;
+ this.store.removeLocalItem(target.key);
+ });
+ this.strings.interpolate('catalog.record.toast.cleared')
+ .then(txt => this.toast.success(txt));
+ }
+}
+
+
<div id="staff-catalog-record-container">
- <div id='staff-catalog-bib-navigation'>
- <div *ngIf="searchContext.isSearchable()">
- <eg-catalog-record-pagination [recordId]="recordId">
- </eg-catalog-record-pagination>
+ <div class="row ml-0 mr-0">
+ <div id='staff-catalog-bib-navigation'>
+ <div *ngIf="searchContext.isSearchable()">
+ <eg-catalog-record-pagination [recordId]="recordId">
+ </eg-catalog-record-pagination>
+ </div>
+ </div>
+ <!-- push the actions component to the right -->
+ <div class="flex-1"></div>
+ <div id='staff-catalog-bib-navigation'>
+ <eg-catalog-record-actions [recordId]="recordId">
+ </eg-catalog-record-actions>
</div>
</div>
<div id='staff-catalog-bib-summary-container' class='mt-1'>