forked from hazza/dspace-angular
collection is displayed below the submitter
This commit is contained in:
@@ -18,6 +18,7 @@ import { ClaimedApprovedSearchResultListElementComponent } from '../shared/objec
|
|||||||
import { ClaimedDeclinedSearchResultListElementComponent } from '../shared/object-list/my-dspace-result-list-element/claimed-search-result/claimed-declined-search-result/claimed-declined-search-result-list-element.component';
|
import { ClaimedDeclinedSearchResultListElementComponent } from '../shared/object-list/my-dspace-result-list-element/claimed-search-result/claimed-declined-search-result/claimed-declined-search-result-list-element.component';
|
||||||
import { ResearchEntitiesModule } from '../entity-groups/research-entities/research-entities.module';
|
import { ResearchEntitiesModule } from '../entity-groups/research-entities/research-entities.module';
|
||||||
import { ItemSubmitterComponent } from '../shared/object-collection/shared/mydspace-item-submitter/item-submitter.component';
|
import { ItemSubmitterComponent } from '../shared/object-collection/shared/mydspace-item-submitter/item-submitter.component';
|
||||||
|
import { ItemCollectionComponent } from '../shared/object-collection/shared/mydspace-item-collection/item-collection.component';
|
||||||
import { ItemDetailPreviewComponent } from '../shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview.component';
|
import { ItemDetailPreviewComponent } from '../shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview.component';
|
||||||
import { ItemDetailPreviewFieldComponent } from '../shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview-field/item-detail-preview-field.component';
|
import { ItemDetailPreviewFieldComponent } from '../shared/object-detail/my-dspace-result-detail-element/item-detail-preview/item-detail-preview-field/item-detail-preview-field.component';
|
||||||
import { ItemListPreviewComponent } from '../shared/object-list/my-dspace-result-list-element/item-list-preview/item-list-preview.component';
|
import { ItemListPreviewComponent } from '../shared/object-list/my-dspace-result-list-element/item-list-preview/item-list-preview.component';
|
||||||
@@ -44,6 +45,7 @@ const ENTRY_COMPONENTS = [
|
|||||||
const DECLARATIONS = [
|
const DECLARATIONS = [
|
||||||
...ENTRY_COMPONENTS,
|
...ENTRY_COMPONENTS,
|
||||||
ItemSubmitterComponent,
|
ItemSubmitterComponent,
|
||||||
|
ItemCollectionComponent,
|
||||||
ItemDetailPreviewComponent,
|
ItemDetailPreviewComponent,
|
||||||
ItemDetailPreviewFieldComponent,
|
ItemDetailPreviewFieldComponent,
|
||||||
ItemListPreviewComponent,
|
ItemListPreviewComponent,
|
||||||
|
@@ -0,0 +1,7 @@
|
|||||||
|
<div class="mt-2 mb-2" *ngIf="(collection$ | async)">
|
||||||
|
<span class="text-muted">{{'collection.listelement.badge' | translate}}:
|
||||||
|
<a [routerLink]="['/collections', (collection$ | async)?.id]">
|
||||||
|
{{(collection$ | async)?.name}}
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
</div>
|
@@ -0,0 +1,65 @@
|
|||||||
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
import { EMPTY, Observable } from 'rxjs';
|
||||||
|
import { map, mergeMap } from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
|
import { isNotEmpty } from '../../../empty.util';
|
||||||
|
import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
|
||||||
|
import { Collection } from '../../../../core/shared/collection.model';
|
||||||
|
import { getFirstCompletedRemoteData } from '../../../../core/shared/operators';
|
||||||
|
import { LinkService } from '../../../../core/cache/builders/link.service';
|
||||||
|
import { followLink } from '../../../utils/follow-link-config.model';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This component represents a badge with collection information.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-item-collection',
|
||||||
|
styleUrls: ['./item-collection.component.scss'],
|
||||||
|
templateUrl: './item-collection.component.html'
|
||||||
|
})
|
||||||
|
export class ItemCollectionComponent implements OnInit {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The target object
|
||||||
|
*/
|
||||||
|
@Input() object: any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The collection object
|
||||||
|
*/
|
||||||
|
collection$: Observable<Collection>;
|
||||||
|
|
||||||
|
public constructor(protected linkService: LinkService) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize collection object
|
||||||
|
*/
|
||||||
|
ngOnInit() {
|
||||||
|
|
||||||
|
this.linkService.resolveLinks(this.object, followLink('workflowitem', {},
|
||||||
|
followLink('collection',{})
|
||||||
|
));
|
||||||
|
this.collection$ = (this.object.workflowitem as Observable<RemoteData<WorkflowItem>>).pipe(
|
||||||
|
getFirstCompletedRemoteData(),
|
||||||
|
mergeMap((rd: RemoteData<WorkflowItem>) => {
|
||||||
|
if (rd.hasSucceeded && isNotEmpty(rd.payload)) {
|
||||||
|
return (rd.payload.collection as Observable<RemoteData<Collection>>).pipe(
|
||||||
|
getFirstCompletedRemoteData(),
|
||||||
|
map((rds: RemoteData<Collection>) => {
|
||||||
|
if (rds.hasSucceeded && isNotEmpty(rds.payload)) {
|
||||||
|
return rds.payload;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return EMPTY;
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
@@ -1,3 +1,3 @@
|
|||||||
<div class="mt-2 mb-2" *ngIf="(submitter$ | async)">
|
<div class="mt-2 mb-2" *ngIf="(submitter$ | async)">
|
||||||
<span class="text-muted">{{'submission.workflow.tasks.generic.submitter' | translate}} : <span class="badge badge-info">{{(submitter$ | async)?.name}}</span></span>
|
<span class="text-muted">{{'submission.workflow.tasks.generic.submitter' | translate}}: <span class="badge badge-info">{{(submitter$ | async)?.name}}</span></span>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -15,34 +15,36 @@
|
|||||||
<ds-truncatable [id]="item.id">
|
<ds-truncatable [id]="item.id">
|
||||||
<h3 [innerHTML]="dsoTitle" [ngClass]="{'lead': true,'text-muted': !item.firstMetadataValue('dc.title')}"></h3>
|
<h3 [innerHTML]="dsoTitle" [ngClass]="{'lead': true,'text-muted': !item.firstMetadataValue('dc.title')}"></h3>
|
||||||
<div>
|
<div>
|
||||||
<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.hasMetadata('dc.publisher')" class="item-list-publisher"
|
(<span *ngIf="item.hasMetadata('dc.publisher')" class="item-list-publisher"
|
||||||
[innerHTML]="item.firstMetadataValue('dc.publisher') + ', '"></span>
|
[innerHTML]="item.firstMetadataValue('dc.publisher') + ', '"></span>
|
||||||
<span class="item-list-date"
|
<span class="item-list-date"
|
||||||
[innerHTML]="item.firstMetadataValue('dc.date.issued') || ('mydspace.results.no-date' | translate)"></span>)
|
[innerHTML]="item.firstMetadataValue('dc.date.issued') || ('mydspace.results.no-date' | translate)"></span>)
|
||||||
<span *ngIf="item.hasMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']);"
|
<span *ngIf="item.hasMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']);"
|
||||||
class="item-list-authors">
|
class="item-list-authors">
|
||||||
<span
|
<span
|
||||||
*ngIf="item.allMetadataValues(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']).length === 0">{{'mydspace.results.no-authors' | translate}}</span>
|
*ngIf="item.allMetadataValues(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']).length === 0">{{'mydspace.results.no-authors'
|
||||||
<span
|
| translate}}</span>
|
||||||
*ngFor="let author of item.allMetadataValues(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']); let last=last;">
|
<span
|
||||||
<span [innerHTML]="author"><span [innerHTML]="author"></span></span>
|
*ngFor="let author of item.allMetadataValues(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']); let last=last;">
|
||||||
<span *ngIf="!last">; </span>
|
<span [innerHTML]="author"><span [innerHTML]="author"></span></span>
|
||||||
|
<span *ngIf="!last">; </span>
|
||||||
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
</ds-truncatable-part>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
</ds-truncatable-part>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<ds-truncatable-part [id]="item.id" [minLines]="1" class="item-list-abstract">
|
<ds-truncatable-part [id]="item.id" [minLines]="1" class="item-list-abstract">
|
||||||
<span [ngClass]="{'text-muted': !item.firstMetadataValue('dc.description.abstract')}"
|
<span [ngClass]="{'text-muted': !item.firstMetadataValue('dc.description.abstract')}"
|
||||||
[innerHTML]="(item.firstMetadataValue('dc.description.abstract')) || ('mydspace.results.no-abstract' | translate)"></span>
|
[innerHTML]="(item.firstMetadataValue('dc.description.abstract')) || ('mydspace.results.no-abstract' | translate)"></span>
|
||||||
</ds-truncatable-part>
|
</ds-truncatable-part>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</ds-truncatable>
|
</ds-truncatable>
|
||||||
<ds-item-submitter *ngIf="showSubmitter" [object]="object.indexableObject"></ds-item-submitter>
|
<ds-item-submitter *ngIf="showSubmitter" [object]="object.indexableObject"></ds-item-submitter>
|
||||||
|
<ds-item-collection [object]="object.indexableObject"></ds-item-collection>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
@@ -8,6 +8,7 @@ import {
|
|||||||
import { SearchResult } from '../../../search/models/search-result.model';
|
import { SearchResult } from '../../../search/models/search-result.model';
|
||||||
import { APP_CONFIG, AppConfig } from '../../../../../config/app-config.interface';
|
import { APP_CONFIG, AppConfig } from '../../../../../config/app-config.interface';
|
||||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||||
|
import { WorkflowItem } from 'src/app/core/submission/models/workflowitem.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component show metadata for the given item object in the list view.
|
* This component show metadata for the given item object in the list view.
|
||||||
@@ -40,6 +41,11 @@ export class ItemListPreviewComponent implements OnInit {
|
|||||||
*/
|
*/
|
||||||
@Input() showSubmitter = false;
|
@Input() showSubmitter = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the workflow of the item
|
||||||
|
*/
|
||||||
|
@Input() workflowItem: WorkflowItem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display thumbnails if required by configuration
|
* Display thumbnails if required by configuration
|
||||||
*/
|
*/
|
||||||
|
@@ -1,16 +0,0 @@
|
|||||||
<div>
|
|
||||||
<div class="row" *ngIf="collection">
|
|
||||||
<div class="col-12">
|
|
||||||
<div class="col-12">
|
|
||||||
<i>
|
|
||||||
<small>{{"collection.listelement.badge" | translate}}:</small>
|
|
||||||
</i>
|
|
||||||
|
|
||||||
<a [href]="uiBaseUrl+'/collections/'+collection.uuid">
|
|
||||||
{{collection.metadata["dc.title"][0]["value"]}}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<ng-template #vcr></ng-template>
|
|
||||||
</div>
|
|
@@ -6,8 +6,6 @@ import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspa
|
|||||||
import { SearchResult } from '../../../search/models/search-result.model';
|
import { SearchResult } from '../../../search/models/search-result.model';
|
||||||
import { WorkflowItem } from 'src/app/core/submission/models/workflowitem.model';
|
import { WorkflowItem } from 'src/app/core/submission/models/workflowitem.model';
|
||||||
import { ThemeService } from 'src/app/shared/theme-support/theme.service';
|
import { ThemeService } from 'src/app/shared/theme-support/theme.service';
|
||||||
import { CollectionDataService } from 'src/app/core/data/collection-data.service';
|
|
||||||
import { environment } from '../../../../../../src/environments/environment';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Themed wrapper for ItemListPreviewComponent
|
* Themed wrapper for ItemListPreviewComponent
|
||||||
@@ -15,10 +13,10 @@ import { environment } from '../../../../../../src/environments/environment';
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-themed-item-list-preview',
|
selector: 'ds-themed-item-list-preview',
|
||||||
styleUrls: [],
|
styleUrls: [],
|
||||||
templateUrl: 'themed-item-list-preview.component.html'
|
templateUrl: '../../../theme-support/themed.component.html'
|
||||||
})
|
})
|
||||||
export class ThemedItemListPreviewComponent extends ThemedComponent<ItemListPreviewComponent> {
|
export class ThemedItemListPreviewComponent extends ThemedComponent<ItemListPreviewComponent> {
|
||||||
protected inAndOutputNames: (keyof ItemListPreviewComponent & keyof this)[] = ['item', 'object', 'status', 'showSubmitter'];
|
protected inAndOutputNames: (keyof ItemListPreviewComponent & keyof this)[] = ['item', 'object', 'status', 'showSubmitter', 'workflowItem'];
|
||||||
|
|
||||||
@Input() item: Item;
|
@Input() item: Item;
|
||||||
|
|
||||||
@@ -30,39 +28,16 @@ export class ThemedItemListPreviewComponent extends ThemedComponent<ItemListPrev
|
|||||||
|
|
||||||
@Input() workflowItem: WorkflowItem;
|
@Input() workflowItem: WorkflowItem;
|
||||||
|
|
||||||
collection: any = null;
|
|
||||||
|
|
||||||
uiBaseUrl: string = environment.ui.baseUrl;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected resolver: ComponentFactoryResolver,
|
protected resolver: ComponentFactoryResolver,
|
||||||
protected cdr: ChangeDetectorRef,
|
protected cdr: ChangeDetectorRef,
|
||||||
protected themeService: ThemeService,
|
protected themeService: ThemeService,
|
||||||
protected collectionDataService: CollectionDataService
|
|
||||||
) {
|
) {
|
||||||
super(resolver, cdr, themeService);
|
super(resolver, cdr, themeService);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
super.ngOnInit();
|
super.ngOnInit();
|
||||||
this.getCollectionName();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected getCollectionName(): void {
|
|
||||||
|
|
||||||
if (!this.item) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const collectionId = this.workflowItem?.sections.collection;
|
|
||||||
|
|
||||||
if (!collectionId) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.collectionDataService.findByHref(`${environment.rest.baseUrl}/api/core/collections/${collectionId}`).subscribe(collection => {
|
|
||||||
this.collection = collection?.payload;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected getComponentName(): string {
|
protected getComponentName(): string {
|
||||||
|
Reference in New Issue
Block a user