From 7ebfa7c2695ff782f4041d69155f7333c466202f Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 19 Mar 2019 12:10:32 -0400 Subject: [PATCH] lpxxx bib summary support collapse setting Signed-off-by: Bill Erickson --- .../share/bib-summary/bib-summary.component.html | 8 +++--- .../share/bib-summary/bib-summary.component.ts | 33 ++++++++++++++-------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/share/bib-summary/bib-summary.component.html b/Open-ILS/src/eg2/src/app/staff/share/bib-summary/bib-summary.component.html index d49de1bd7d..530e1080e2 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/bib-summary/bib-summary.component.html +++ b/Open-ILS/src/eg2/src/app/staff/share/bib-summary/bib-summary.component.html @@ -8,12 +8,12 @@
+ *ngIf="!expand" (click)="expand=true"> expand_more + *ngIf="expand" (click)="expand=false"> expand_less
@@ -36,7 +36,7 @@ -
  • +
  • Author:
    {{summary.display.author}}
    @@ -52,7 +52,7 @@
  • -
  • +
  • Bib Call #:
    {{summary.bibCallNumber}}
    diff --git a/Open-ILS/src/eg2/src/app/staff/share/bib-summary/bib-summary.component.ts b/Open-ILS/src/eg2/src/app/staff/share/bib-summary/bib-summary.component.ts index 645b56cd78..954cb8bfe3 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/bib-summary/bib-summary.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/bib-summary/bib-summary.component.ts @@ -1,9 +1,8 @@ import {Component, OnInit, Input} from '@angular/core'; -import {NetService} from '@eg/core/net.service'; import {OrgService} from '@eg/core/org.service'; -import {PcrudService} from '@eg/core/pcrud.service'; -import {CatalogService} from '@eg/share/catalog/catalog.service'; -import {BibRecordService, BibRecordSummary} from '@eg/share/catalog/bib-record.service'; +import {BibRecordService, BibRecordSummary + } from '@eg/share/catalog/bib-record.service'; +import {ServerStoreService} from '@eg/core/server-store.service'; @Component({ selector: 'eg-bib-summary', @@ -13,10 +12,16 @@ import {BibRecordService, BibRecordSummary} from '@eg/share/catalog/bib-record.s export class BibSummaryComponent implements OnInit { initDone = false; - expandDisplay = true; - @Input() set expand(e: boolean) { - this.expandDisplay = e; + + // True / false if the display is vertically expanded + private _exp: boolean; + set expand(e: boolean) { + this._exp = e; + if (this.initDone) { + this.saveExpandState(); + } } + get expand(): boolean { return this._exp; } // If provided, the record will be fetched by the component. @Input() recordId: number; @@ -32,14 +37,12 @@ export class BibSummaryComponent implements OnInit { constructor( private bib: BibRecordService, - private cat: CatalogService, - private net: NetService, private org: OrgService, - private pcrud: PcrudService + private store: ServerStoreService ) {} ngOnInit() { - this.initDone = true; + if (this.summary) { this.summary.getBibCallNumber(); } else { @@ -47,6 +50,14 @@ export class BibSummaryComponent implements OnInit { this.loadSummary(); } } + + this.store.getItem('eg.cat.record.summary.collapse') + .then(value => this.expand = !value) + .then(() => this.initDone = true); + } + + saveExpandState() { + this.store.setItem('eg.cat.record.summary.collapse', !this.expand); } loadSummary(): void { -- 2.11.0