Changes based on review feedback

This commit is contained in:
Giuseppe Digilio
2019-04-19 18:41:48 +02:00
parent c959b49d19
commit 86324c366f
7 changed files with 15 additions and 56 deletions

View File

@@ -3,17 +3,17 @@
<ds-mydspace-item-status [status]="status"></ds-mydspace-item-status>
</ng-container>
<ds-truncatable [id]="item.id">
<h3 class="h3-title" [innerHTML]="firstMetadataValue('dc.title') || ('mydspace.results.no-title' | translate)" [ngClass]="{'lead': true,'text-muted': !firstMetadataValue('dc.title')}"></h3>
<h3 class="h3-title" [innerHTML]="item.firstMetadataValue('dc.title') || ('mydspace.results.no-title' | translate)" [ngClass]="{'lead': true,'text-muted': !item.firstMetadataValue('dc.title')}"></h3>
<div>
<span class="text-muted">
<ds-truncatable-part [id]="item.id" [minLines]="1">
(<span *ngIf="item.hasMetadata('dc.publisher')" class="item-list-publisher"
[innerHTML]="firstMetadataValue('dc.publisher') + ', '"></span>
<span class="item-list-date" [innerHTML]="firstMetadataValue('dc.date.issued') || ('mydspace.results.no-date' | translate)"></span>)
[innerHTML]="item.firstMetadataValue('dc.publisher') + ', '"></span>
<span class="item-list-date" [innerHTML]="item.firstMetadataValue('dc.date.issued') || ('mydspace.results.no-date' | translate)"></span>)
<span *ngIf="item.hasMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']);"
class="item-list-authors">
<span *ngIf="allMetadataValues(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']).length === 0">{{'mydspace.results.no-authors' | translate}}</span>
<span *ngFor="let author of allMetadataValues(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']); let last=last;">
<span *ngIf="item.allMetadataValues(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']).length === 0">{{'mydspace.results.no-authors' | translate}}</span>
<span *ngFor="let author of item.allMetadataValues(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']); let last=last;">
<span [innerHTML]="author"><span [innerHTML]="author"></span></span>
</span>
</span>
@@ -22,8 +22,8 @@
</span>
<ds-truncatable-part [id]="item.id" [minLines]="1" class="item-list-abstract">
<span [ngClass]="{'text-muted': !firstMetadataValue('dc.description.abstract')}"
[innerHTML]="(firstMetadataValue('dc.description.abstract')) || ('mydspace.results.no-abstract' | translate)"></span>
<span [ngClass]="{'text-muted': !item.firstMetadataValue('dc.description.abstract')}"
[innerHTML]="(item.firstMetadataValue('dc.description.abstract')) || ('mydspace.results.no-abstract' | translate)"></span>
</ds-truncatable-part>
</div>

View File

@@ -3,7 +3,6 @@ import { Component, Input } from '@angular/core';
import { Item } from '../../../../core/shared/item.model';
import { fadeInOut } from '../../../animations/fade';
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
import { Metadata } from '../../../../core/shared/metadata.utils';
import { MyDSpaceResult } from '../../../../+my-dspace-page/my-dspace-result.model';
/**
@@ -37,24 +36,4 @@ export class ItemListPreviewComponent {
*/
@Input() showSubmitter = false;
/**
* Gets all matching metadata string values from hitHighlights or dso metadata, preferring hitHighlights.
*
* @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see [[Metadata]].
* @returns {string[]} the matching string values or an empty array.
*/
allMetadataValues(keyOrKeys: string | string[]): string[] {
return Metadata.allValues([this.object.hitHighlights, this.item.metadata], keyOrKeys);
}
/**
* Gets the first matching metadata string value from hitHighlights or dso metadata, preferring hitHighlights.
*
* @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see [[Metadata]].
* @returns {string} the first matching string value, or `undefined`.
*/
firstMetadataValue(keyOrKeys: string | string[]): string {
return Metadata.firstValue([this.object.hitHighlights, this.item.metadata], keyOrKeys);
}
}