Skip to content

Commit

Permalink
document: display 'part of' in brief views
Browse files Browse the repository at this point in the history
* Moves 'part of' template and code to a new component in shared
library. This component is used in detailed and brief views.
* Closes rero/rero-ils#1596.

Co-Authored-by: Alicia Zangger <alicia.zangger@rero.ch>
  • Loading branch information
Alicia Zangger committed Feb 2, 2021
1 parent 6fef162 commit 9b3743b
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 26 deletions.
Expand Up @@ -54,6 +54,7 @@ <h5 class="mb-0 card-title">
<ul class="list-unstyled" *ngIf="provisionActivityPublications.length > 0">
<li *ngFor="let publication of provisionActivityPublications">{{ publication.value }}</li>
</ul>
<shared-part-of [record]="record"></shared-part-of>
</ng-container>
</div>
</article>
Expand Up @@ -16,6 +16,7 @@
*/

import { Component, Input } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { ResultItem } from '@rero/ng-core';

@Component({
Expand Down
Expand Up @@ -96,30 +96,7 @@ <h3 id="{{'doc-altgr-title-' + i}}">{{ altgr_title }}</h3>
</ng-container>

<!-- IS PART OF -->
<ng-container *ngFor="let document of record.metadata.partOf; let i = index">
<ng-container *ngIf="document.document.pid | getRecord: 'documents' : 'object' : '': { 'Content-Type': 'application/rero+json' } | async as hostDocument">
<dl class="row mb-0">
<dt id="{{'doc-part-of-label-' + i}}" class="col-auto">
{{ getPartOfLabel(hostDocument) }}
</dt>
<dd class="col mb-0">
<div class="row">
<a id="{{'doc-part-of-' + i}}" [routerLink]="['/records', 'documents', 'detail', document.document.pid]">
{{ getShortMainTitle(hostDocument.metadata.title) }}
</a>
<ng-container *ngIf="document.numbering">
<span>;</span>
<ul class="list-unstyled mb-0 ml-1">
<li *ngFor="let numbering of document.numbering">
<span id="{{'doc-part-of-numbering-' + i}}" *ngIf="formatNumbering(numbering) as num">{{ num }}</span>
</li>
</ul>
</ng-container>
</div>
</dd>
</dl>
</ng-container>
</ng-container>
<shared-part-of [record]="record" isBrief="false"></shared-part-of>

<!-- ABSTRACT -->
<ng-container *ngIf=" record.metadata.abstracts && record.metadata.abstracts.length > 0">
Expand Down
Expand Up @@ -66,6 +66,7 @@ <h4 class="card-title mb-1">
</a>
<pre class="collapse border border-secondary mt-1" id="{{'score'+record.metadata.pid }}">{{record.explanation|json}}</pre>
</div>
<shared-part-of [record]="record"></shared-part-of>
</article>
</div>
</article>
7 changes: 5 additions & 2 deletions projects/shared/src/lib/shared.module.ts
Expand Up @@ -37,6 +37,7 @@ import { PersonBriefComponent } from './view/brief/person-brief/person-brief.com
import { ItemHoldingsCallNumberPipe } from './pipe/item-holdings-call-number.pipe';
import { InheritedCallNumberComponent } from './view/inherited-call-number/inherited-call-number.component';
import { ThumbnailComponent } from './view/thumbnail/thumbnail.component';
import { PartOfComponent } from './view/brief/part-of/part-of.component';

@NgModule({
declarations: [
Expand All @@ -55,7 +56,8 @@ import { ThumbnailComponent } from './view/thumbnail/thumbnail.component';
UrlActivePipe,
ItemHoldingsCallNumberPipe,
InheritedCallNumberComponent,
ThumbnailComponent
ThumbnailComponent,
PartOfComponent
],
exports: [
CommonModule,
Expand All @@ -75,7 +77,8 @@ import { ThumbnailComponent } from './view/thumbnail/thumbnail.component';
Nl2brPipe,
ItemHoldingsCallNumberPipe,
InheritedCallNumberComponent,
ThumbnailComponent
ThumbnailComponent,
PartOfComponent
],
imports: [
CommonModule,
Expand Down
1 change: 1 addition & 0 deletions projects/shared/src/public-api.ts
Expand Up @@ -40,6 +40,7 @@ export * from './lib/shared.module';
export * from './lib/view/brief/contribution-brief/contribution-brief.component';
export * from './lib/view/brief/contribution-sources/contribution-sources.component';
export * from './lib/view/brief/organisation-brief/organisation-brief.component';
export * from './lib/view/brief/part-of/part-of.component';
export * from './lib/view/brief/person-brief/person-brief.component';
export * from './lib/view/inherited-call-number/inherited-call-number.component';
export * from './lib/view/thumbnail/thumbnail.component';

0 comments on commit 9b3743b

Please sign in to comment.