<div>
<a class="with-material-icon no-href text-primary"
title="Show More" i18n-title
- *ngIf="!expandDisplay" (click)="expandDisplay=true">
+ *ngIf="!expand" (click)="expand=true">
<span class="material-icons">expand_more</span>
</a>
<a class="with-material-icon no-href text-primary"
title="Show Less" i18n-title
- *ngIf="expandDisplay" (click)="expandDisplay=false">
+ *ngIf="expand" (click)="expand=false">
<span class="material-icons">expand_less</span>
</a>
</div>
</div>
</div>
</li>
- <li class="list-group-item" *ngIf="expandDisplay">
+ <li class="list-group-item" *ngIf="expand">
<div class="d-flex">
<div class="flex-1 font-weight-bold" i18n>Author:</div>
<div class="flex-3">{{summary.display.author}}</div>
</div>
</div>
</li>
- <li class="list-group-item" *ngIf="expandDisplay">
+ <li class="list-group-item" *ngIf="expand">
<div class="d-flex">
<div class="flex-1 font-weight-bold" i18n>Bib Call #:</div>
<div class="flex-3">{{summary.bibCallNumber}}</div>
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',
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;
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 {
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 {