-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: add relations to simple item view
Add dcterms.relation, cg.identifier.dataurl, and cg.link.citation to the simple item view page. Style mimics our DSpace 6 style.
- Loading branch information
Showing
4 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...e/simple/field-components/specific-field/relation/item-page-relation-field.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<div class="item-page-field" *ngIf="item.hasMetadata(['dcterms.relation', 'cg.link.citation', 'cg.identifier.dataurl'])"> | ||
<div class="simple-view-element"> | ||
<h5>Related Material</h5> | ||
<div class="simple-view-element-body"> | ||
<div class="ml-3"> | ||
<ng-container *ngIf="item.hasMetadata('dcterms.relation')"> | ||
<div class="mb-2">Related reference: | ||
<ng-container *ngFor="let mdValue of item?.allMetadata('dcterms.relation'); let last=last;"> | ||
<ng-container [ngTemplateOutlet]="relatedLink" | ||
[ngTemplateOutletContext]="{value: mdValue.value}"> | ||
</ng-container> | ||
<span *ngIf="!last">; </span> | ||
</ng-container> | ||
</div> | ||
</ng-container> | ||
|
||
<ng-container *ngIf="item.hasMetadata('cg.identifier.dataurl')"> | ||
<div class="mb-2">Related dataset: | ||
<ng-container *ngFor="let mdValue of item?.allMetadata('cg.identifier.dataurl'); let last=last;"> | ||
<ng-container [ngTemplateOutlet]="relatedLink" | ||
[ngTemplateOutletContext]="{value: mdValue.value}"> | ||
</ng-container> | ||
<span *ngIf="!last">; </span> | ||
</ng-container> | ||
</div> | ||
</ng-container> | ||
|
||
<ng-container *ngIf="item.hasMetadata('cg.link.citation')"> | ||
<ng-container *ngFor="let mdValue of item?.allMetadata('cg.link.citation')" | ||
[ngTemplateOutlet]="relatedCitation" | ||
[ngTemplateOutletContext]="{value: mdValue.value}"> | ||
</ng-container> | ||
</ng-container> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<!-- Template for related links we want to show --> | ||
<ng-template #relatedLink let-value="value"> | ||
<a [href]=value target="_blank" [innerHTML]="value"></a> | ||
</ng-template> | ||
|
||
<!-- Template for related citations --> | ||
<ng-template #relatedCitation let-value="value"> | ||
<h5>Related Citation</h5> | ||
<div class="mb-2" [innerHTML]="value"></div> | ||
</ng-template> |
20 changes: 20 additions & 0 deletions
20
...age/simple/field-components/specific-field/relation/item-page-relation-field.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Component, Input } from '@angular/core'; | ||
|
||
import { Item } from '../../../../../core/shared/item.model'; | ||
import { ItemPageFieldComponent } from '../item-page-field.component'; | ||
|
||
@Component({ | ||
selector: 'ds-item-page-relation-field', | ||
//styleUrls: ['./item-page-relation-field.component.scss'], | ||
templateUrl: './item-page-relation-field.component.html' | ||
}) | ||
/** | ||
* This component renders the related material section. | ||
*/ | ||
export class ItemPageRelationFieldComponent extends ItemPageFieldComponent { | ||
|
||
/** | ||
* The item to display metadata for | ||
*/ | ||
@Input() item: Item; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters