61133: Post-merge refactoring

This commit is contained in:
Kristof De Langhe
2019-03-15 10:14:42 +01:00
parent 6c3fb556d8
commit a9397f0b11
16 changed files with 51 additions and 62 deletions

View File

@@ -1,5 +1,5 @@
<h2 class="item-page-title-field"> <h2 class="item-page-title-field">
<ds-metadata-values [values]="item?.filterMetadata(['dc.title'])"></ds-metadata-values> <ds-metadata-values [mdValues]="item?.allMetadata(['dc.title'])"></ds-metadata-values>
</h2> </h2>
<div class="row"> <div class="row">
<div class="col-xs-12 col-md-4"> <div class="col-xs-12 col-md-4">

View File

@@ -1,5 +1,5 @@
<h2 class="item-page-title-field"> <h2 class="item-page-title-field">
<ds-metadata-values [values]="item?.filterMetadata(['dc.title'])"></ds-metadata-values> <ds-metadata-values [mdValues]="item?.allMetadata(['dc.title'])"></ds-metadata-values>
</h2> </h2>
<div class="row"> <div class="row">
<div class="col-xs-12 col-md-4"> <div class="col-xs-12 col-md-4">

View File

@@ -1,5 +1,5 @@
<h2 class="item-page-title-field"> <h2 class="item-page-title-field">
<ds-metadata-values [values]="item?.filterMetadata(['dc.title'])"></ds-metadata-values> <ds-metadata-values [mdValues]="item?.allMetadata(['dc.title'])"></ds-metadata-values>
</h2> </h2>
<div class="row"> <div class="row">
<div class="col-xs-12 col-md-4"> <div class="col-xs-12 col-md-4">

View File

@@ -1,5 +1,5 @@
<h2 class="item-page-title-field"> <h2 class="item-page-title-field">
<ds-metadata-values [values]="item?.filterMetadata(['orgunit.identifier.name'])"></ds-metadata-values> <ds-metadata-values [mdValues]="item?.allMetadata(['orgunit.identifier.name'])"></ds-metadata-values>
</h2> </h2>
<div class="row"> <div class="row">
<div class="col-xs-12 col-md-4"> <div class="col-xs-12 col-md-4">

View File

@@ -1,5 +1,5 @@
<h2 class="item-page-title-field"> <h2 class="item-page-title-field">
<ds-metadata-values [values]="item?.filterMetadata(['dc.contributor.author'])"></ds-metadata-values> <ds-metadata-values [mdValues]="item?.allMetadata(['dc.contributor.author'])"></ds-metadata-values>
</h2> </h2>
<div class="row"> <div class="row">
<div class="col-xs-12 col-md-4"> <div class="col-xs-12 col-md-4">

View File

@@ -1,5 +1,5 @@
<h2 class="item-page-title-field"> <h2 class="item-page-title-field">
<ds-metadata-values [values]="item?.filterMetadata(['project.identifier.name'])"></ds-metadata-values> <ds-metadata-values [mdValues]="item?.allMetadata(['project.identifier.name'])"></ds-metadata-values>
</h2> </h2>
<div class="row"> <div class="row">
<div class="col-xs-12 col-md-4"> <div class="col-xs-12 col-md-4">

View File

@@ -119,21 +119,21 @@ export class DSpaceObject implements CacheableObject, ListableObject {
} }
/** /**
* Find metadata on a specific field and order all of them using their "place" property. * Find metadata on a specific field and order all of them using their "order" property.
* @param key * @param key
*/ */
findMetadataSortedByPlace(key: string): MetadataValue[] { findMetadataSortedByPlace(key: string): MetadataValue[] {
return this.allMetadata([key]).sort((a: MetadataValue, b: MetadataValue) => { return this.allMetadata([key]).sort((a: MetadataValue, b: MetadataValue) => {
if (hasNoValue(a.place) && hasNoValue(b.place)) { if (hasNoValue(a.order) && hasNoValue(b.order)) {
return 0; return 0;
} }
if (hasNoValue(a.place)) { if (hasNoValue(a.order)) {
return -1; return -1;
} }
if (hasNoValue(b.place)) { if (hasNoValue(b.order)) {
return 1; return 1;
} }
return a.place - b.place; return a.order - b.order;
}); });
} }

View File

@@ -25,21 +25,17 @@ export class MetadataValue {
value: string; value: string;
/** /**
* The place of this Metadatum within his list of metadata * The place of this MetadataValue within his list of metadata
* This is used to render metadata in a specific custom order * This is used to render metadata in a specific custom order
*/ */
@autoserialize @autoserialize
place: number; order: number;
/** /** The authority key used for authority-controlled metadata */
* The authority key used for authority-controlled metadata
*/
@autoserialize @autoserialize
authority: string; authority: string;
/** /** The authority confidence value */
* The authority confidence value
*/
@autoserialize @autoserialize
confidence: number; confidence: number;
@@ -91,23 +87,16 @@ export class MetadatumViewModel {
/** The string value. */ /** The string value. */
value: string; value: string;
/** The order. */
order: number;
/** /**
* The place of this Metadatum within his list of metadata * The place of this MetadataValue within his list of metadata
* This is used to render metadata in a specific custom order * This is used to render metadata in a specific custom order
*/ */
place: number; order: number;
/** /** The authority key used for authority-controlled metadata */
* The authority key used for authority-controlled metadata
*/
authority: string; authority: string;
/** /** The authority confidence value */
* The authority confidence value
*/
confidence: number; confidence: number;
} }

View File

@@ -1,17 +1,17 @@
<ds-truncatable [id]="item.id"> <ds-truncatable [id]="item.id">
<a <a
[routerLink]="['/items/' + item.id]" class="lead" [routerLink]="['/items/' + item.id]" class="lead"
[innerHTML]="getFirstValue('dc.title')"></a> [innerHTML]="firstMetadataValue('dc.title')"></a>
<span class="text-muted"> <span class="text-muted">
<ds-truncatable-part [id]="item.id" [minLines]="1"> <ds-truncatable-part [id]="item.id" [minLines]="1">
<span *ngIf="item.filterMetadata(['journalvolume.identifier.volume']).length > 0" <span *ngIf="item.allMetadata(['journalvolume.identifier.volume']).length > 0"
class="item-list-journal-issues"> class="item-list-journal-issues">
<span *ngFor="let value of getValues(['journalvolume.identifier.volume']); let last=last;"> <span *ngFor="let value of allMetadataValues(['journalvolume.identifier.volume']); let last=last;">
<span [innerHTML]="value"><span [innerHTML]="value"></span></span> <span [innerHTML]="value"><span [innerHTML]="value"></span></span>
</span> </span>
<span *ngIf="item.filterMetadata(['journalissue.identifier.number']).length > 0" <span *ngIf="item.allMetadata(['journalissue.identifier.number']).length > 0"
class="item-list-journal-issue-numbers"> class="item-list-journal-issue-numbers">
<span *ngFor="let value of getValues(['journalissue.identifier.number']); let last=last;"> <span *ngFor="let value of allMetadataValues(['journalissue.identifier.number']); let last=last;">
<span> - </span><span [innerHTML]="value"><span [innerHTML]="value"></span></span> <span> - </span><span [innerHTML]="value"><span [innerHTML]="value"></span></span>
</span> </span>
</span> </span>

View File

@@ -1,18 +1,18 @@
<ds-truncatable [id]="item.id"> <ds-truncatable [id]="item.id">
<a <a
[routerLink]="['/items/' + item.id]" class="lead" [routerLink]="['/items/' + item.id]" class="lead"
[innerHTML]="getFirstValue('dc.title')"></a> [innerHTML]="firstMetadataValue('dc.title')"></a>
<span class="text-muted"> <span class="text-muted">
<ds-truncatable-part [id]="item.id" [minLines]="1"> <ds-truncatable-part [id]="item.id" [minLines]="1">
<span *ngIf="item.filterMetadata(['journal.title']).length > 0" <span *ngIf="item.allMetadata(['journal.title']).length > 0"
class="item-list-journal-volumes"> class="item-list-journal-volumes">
<span *ngFor="let value of getValues(['journal.title']); let last=last;"> <span *ngFor="let value of allMetadataValues(['journal.title']); let last=last;">
<span [innerHTML]="value"><span [innerHTML]="value"></span></span> <span [innerHTML]="value"><span [innerHTML]="value"></span></span>
</span> </span>
</span> </span>
<span *ngIf="item.filterMetadata(['journalvolume.identifier.volume']).length > 0" <span *ngIf="item.allMetadata(['journalvolume.identifier.volume']).length > 0"
class="item-list-journal-volume-identifiers"> class="item-list-journal-volume-identifiers">
<span *ngFor="let value of getValues(['journalvolume.identifier.volume']); let last=last;"> <span *ngFor="let value of allMetadataValues(['journalvolume.identifier.volume']); let last=last;">
<span> (</span><span [innerHTML]="value"><span [innerHTML]="value"></span></span><span>)</span> <span> (</span><span [innerHTML]="value"><span [innerHTML]="value"></span></span><span>)</span>
</span> </span>
</span> </span>

View File

@@ -1,7 +1,7 @@
<ds-truncatable [id]="item.id"> <ds-truncatable [id]="item.id">
<a <a
[routerLink]="['/items/' + item.id]" class="lead" [routerLink]="['/items/' + item.id]" class="lead"
[innerHTML]="getFirstValue('dc.title')"></a> [innerHTML]="firstMetadataValue('dc.title')"></a>
<span class="text-muted"> <span class="text-muted">
<ds-truncatable-part [id]="item.id" [minLines]="1"> <ds-truncatable-part [id]="item.id" [minLines]="1">
<span *ngIf="item.filterMetadata(['journal.identifier.issn']).length > 0" <span *ngIf="item.filterMetadata(['journal.identifier.issn']).length > 0"

View File

@@ -1,13 +1,13 @@
<ds-truncatable [id]="item.id"> <ds-truncatable [id]="item.id">
<a <a
[routerLink]="['/items/' + item.id]" class="lead" [routerLink]="['/items/' + item.id]" class="lead"
[innerHTML]="getFirstValue('orgunit.identifier.name')"></a> [innerHTML]="firstMetadataValue('orgunit.identifier.name')"></a>
<span class="text-muted"> <span class="text-muted">
<ds-truncatable-part [id]="item.id" [minLines]="3"> <ds-truncatable-part [id]="item.id" [minLines]="3">
<span *ngIf="item.filterMetadata(['orgunit.identifier.description']).length > 0" <span *ngIf="item.allMetadata(['orgunit.identifier.description']).length > 0"
class="item-list-orgunit-description"> class="item-list-orgunit-description">
<ds-truncatable-part [id]="item.id" [minLines]="3"><span <ds-truncatable-part [id]="item.id" [minLines]="3"><span
[innerHTML]="getFirstValue('orgunit.identifier.description')"></span> [innerHTML]="firstMetadataValue('orgunit.identifier.description')"></span>
</ds-truncatable-part> </ds-truncatable-part>
</span> </span>
</ds-truncatable-part> </ds-truncatable-part>

View File

@@ -1,12 +1,12 @@
<ds-truncatable [id]="item.id"> <ds-truncatable [id]="item.id">
<a <a
[routerLink]="['/items/' + item.id]" class="lead" [routerLink]="['/items/' + item.id]" class="lead"
[innerHTML]="getFirstValue('dc.contributor.author')"></a> [innerHTML]="firstMetadataValue('dc.contributor.author')"></a>
<span class="text-muted"> <span class="text-muted">
<ds-truncatable-part [id]="item.id" [minLines]="1"> <ds-truncatable-part [id]="item.id" [minLines]="1">
<span *ngIf="item.filterMetadata(['person.identifier.jobtitle']).length > 0" <span *ngIf="item.allMetadata(['person.identifier.jobtitle']).length > 0"
class="item-list-job-title"> class="item-list-job-title">
<span *ngFor="let value of getValues(['person.identifier.jobtitle']); let last=last;"> <span *ngFor="let value of allMetadataValues(['person.identifier.jobtitle']); let last=last;">
<span [innerHTML]="value"><span [innerHTML]="value"></span></span> <span [innerHTML]="value"><span [innerHTML]="value"></span></span>
</span> </span>
</span> </span>

View File

@@ -1,8 +1,8 @@
<ng-template #descTemplate> <ng-template #descTemplate>
<span class="text-muted"> <span class="text-muted">
<span *ngIf="item.filterMetadata(['person.identifier.jobtitle']).length > 0" <span *ngIf="item.allMetadata(['person.identifier.jobtitle']).length > 0"
class="item-list-job-title"> class="item-list-job-title">
<span *ngFor="let value of getValues(['person.identifier.jobtitle']); let last=last;"> <span *ngFor="let value of allMetadataValues(['person.identifier.jobtitle']); let last=last;">
<span [innerHTML]="value"><span [innerHTML]="value"></span></span> <span [innerHTML]="value"><span [innerHTML]="value"></span></span>
</span> </span>
</span> </span>
@@ -10,6 +10,6 @@
</ng-template> </ng-template>
<ds-truncatable [id]="item.id"> <ds-truncatable [id]="item.id">
<a [routerLink]="['/items/' + item.id]" <a [routerLink]="['/items/' + item.id]"
[innerHTML]="getFirstValue('dc.contributor.author')" [innerHTML]="firstMetadataValue('dc.contributor.author')"
[tooltip]="descTemplate"></a> [tooltip]="descTemplate"></a>
</ds-truncatable> </ds-truncatable>

View File

@@ -1,12 +1,12 @@
<ds-truncatable [id]="item.id"> <ds-truncatable [id]="item.id">
<a <a
[routerLink]="['/items/' + item.id]" class="lead" [routerLink]="['/items/' + item.id]" class="lead"
[innerHTML]="getFirstValue('project.identifier.name')"></a> [innerHTML]="firstMetadataValue('project.identifier.name')"></a>
<span class="text-muted"> <span class="text-muted">
<ds-truncatable-part [id]="item.id" [minLines]="1"> <ds-truncatable-part [id]="item.id" [minLines]="1">
<span *ngIf="item.filterMetadata(['project.identifier.status']).length > 0" <span *ngIf="item.allMetadata(['project.identifier.status']).length > 0"
class="item-list-status"> class="item-list-status">
<span *ngFor="let value of getValues(['project.identifier.status']); let last=last;"> <span *ngFor="let value of allMetadataValues(['project.identifier.status']); let last=last;">
<span [innerHTML]="value"><span [innerHTML]="value"></span></span> <span [innerHTML]="value"><span [innerHTML]="value"></span></span>
</span> </span>
</span> </span>

View File

@@ -1,24 +1,24 @@
<ds-truncatable [id]="item.id" *ngIf="item !== undefined && item !== null"> <ds-truncatable [id]="item.id" *ngIf="item !== undefined && item !== null">
<a <a
[routerLink]="['/items/' + item.id]" class="lead" [routerLink]="['/items/' + item.id]" class="lead"
[innerHTML]="getFirstValue('dc.title')"></a> [innerHTML]="firstMetadataValue('dc.title')"></a>
<span class="text-muted"> <span class="text-muted">
<ds-truncatable-part [id]="item.id" [minLines]="1"> <ds-truncatable-part [id]="item.id" [minLines]="1">
<ng-container *ngIf="item.findMetadata('dc.publisher') || item.findMetadata('dc.date.issued')">(<span class="item-list-publisher" <ng-container *ngIf="item.allMetadata('dc.publisher') || item.allMetadata('dc.date.issued')">(<span class="item-list-publisher"
[innerHTML]="getFirstValue('dc.publisher')">, </span><span [innerHTML]="firstMetadataValue('dc.publisher')">, </span><span
*ngIf="item.findMetadata('dc.date.issued')" class="item-list-date" *ngIf="item.allMetadata('dc.date.issued')" class="item-list-date"
[innerHTML]="getFirstValue('dc.date.issued')"></span>)</ng-container> [innerHTML]="firstMetadataValue('dc.date.issued')"></span>)</ng-container>
<span *ngIf="item.filterMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']).length > 0" <span *ngIf="item.allMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']).length > 0"
class="item-list-authors"> class="item-list-authors">
<span *ngFor="let author of getValues(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']); let last=last;"> <span *ngFor="let author of allMetadataValues(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']); let last=last;">
<span [innerHTML]="author"><span [innerHTML]="author"></span></span> <span [innerHTML]="author"><span [innerHTML]="author"></span></span>
</span> </span>
</span> </span>
</ds-truncatable-part> </ds-truncatable-part>
</span> </span>
<div *ngIf="item.findMetadata('dc.description.abstract')" class="item-list-abstract"> <div *ngIf="item.allMetadata('dc.description.abstract')" class="item-list-abstract">
<ds-truncatable-part [id]="item.id" [minLines]="3"><span <ds-truncatable-part [id]="item.id" [minLines]="3"><span
[innerHTML]="getFirstValue('dc.description.abstract')"></span> [innerHTML]="firstMetadataValue('dc.description.abstract')"></span>
</ds-truncatable-part> </ds-truncatable-part>
</div> </div>
</ds-truncatable> </ds-truncatable>