mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-14 05:23:06 +00:00
Added the badge to some components for coherence
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
</span>
|
||||
<div class="card-body">
|
||||
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
|
||||
<ds-access-status-badge *ngIf="showAccessStatus" [uuid]="dso.uuid"></ds-access-status-badge>
|
||||
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
|
||||
<h4 class="card-title" [innerHTML]="firstMetadataValue('dc.title')"></h4>
|
||||
</ds-truncatable-part>
|
||||
|
@@ -6,6 +6,7 @@ import { SearchResultGridElementComponent } from '../../search-result-grid-eleme
|
||||
import { Item } from '../../../../../core/shared/item.model';
|
||||
import { ItemSearchResult } from '../../../../object-collection/shared/item-search-result.model';
|
||||
import { getItemPageRoute } from '../../../../../item-page/item-page-routing-paths';
|
||||
import { environment } from 'src/environments/environment';
|
||||
|
||||
@listableObjectComponent('PublicationSearchResult', ViewMode.GridElement)
|
||||
@listableObjectComponent(ItemSearchResult, ViewMode.GridElement)
|
||||
@@ -23,9 +24,14 @@ export class ItemSearchResultGridElementComponent extends SearchResultGridElemen
|
||||
* Route to the item's page
|
||||
*/
|
||||
itemPageRoute: string;
|
||||
/**
|
||||
* Whether to show the access status badge or not
|
||||
*/
|
||||
showAccessStatus: boolean;
|
||||
|
||||
ngOnInit(): void {
|
||||
super.ngOnInit();
|
||||
this.itemPageRoute = getItemPageRoute(this.dso);
|
||||
this.showAccessStatus = environment.ui.showAccessStatuses;
|
||||
}
|
||||
}
|
||||
|
@@ -1,3 +1,3 @@
|
||||
<div *ngIf="accessStatus$ | async as status" class="pl-1">
|
||||
<span class="badge badge-secondary">{{ status | translate }}</span>
|
||||
<div *ngIf="accessStatus$ | async as accessStatus">
|
||||
<span class="badge badge-secondary">{{ accessStatus | translate }}</span>
|
||||
</div>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { Observable } from 'rxjs';
|
||||
import { getFirstSucceededRemoteDataPayload } from 'src/app/core/shared/operators';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
import { Observable, of as observableOf } from 'rxjs';
|
||||
import { getFirstCompletedRemoteData } from 'src/app/core/shared/operators';
|
||||
import { ItemDataService } from 'src/app/core/data/item-data.service';
|
||||
import { AccessStatusObject } from './access-status.model';
|
||||
import { hasValue } from '../../empty.util';
|
||||
@@ -29,9 +29,17 @@ export class AccessStatusBadgeComponent {
|
||||
this._accessStatus$ = this.itemDataService
|
||||
.getAccessStatus(this._uuid)
|
||||
.pipe(
|
||||
getFirstSucceededRemoteDataPayload(),
|
||||
getFirstCompletedRemoteData(),
|
||||
map((accessStatusRD) => {
|
||||
if (accessStatusRD.statusCode !== 401 && hasValue(accessStatusRD.payload)) {
|
||||
return accessStatusRD.payload;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}),
|
||||
map((accessStatus: AccessStatusObject) => hasValue(accessStatus.status) ? accessStatus.status : 'unknown'),
|
||||
map((status: string) => `access-status.${status.toLowerCase()}.listelement.badge`)
|
||||
map((status: string) => `access-status.${status.toLowerCase()}.listelement.badge`),
|
||||
catchError(() => observableOf('access-status.unknown.listelement.badge'))
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -2,7 +2,10 @@
|
||||
<ng-container *ngIf="status">
|
||||
<ds-mydspace-item-status [status]="status"></ds-mydspace-item-status>
|
||||
</ng-container>
|
||||
<div class="d-flex">
|
||||
<ds-type-badge [object]="item"></ds-type-badge>
|
||||
<ds-access-status-badge *ngIf="showAccessStatus" [uuid]="item.uuid" class="pl-1"></ds-access-status-badge>
|
||||
</div>
|
||||
<ds-truncatable [id]="item.id">
|
||||
<h3 [innerHTML]="item.firstMetadataValue('dc.title') || ('mydspace.results.no-title' | translate)" [ngClass]="{'lead': true,'text-muted': !item.firstMetadataValue('dc.title')}"></h3>
|
||||
<div>
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { environment } from 'src/environments/environment';
|
||||
|
||||
import { Item } from '../../../../core/shared/item.model';
|
||||
import { fadeInOut } from '../../../animations/fade';
|
||||
@@ -36,4 +37,12 @@ export class ItemListPreviewComponent {
|
||||
*/
|
||||
@Input() showSubmitter = false;
|
||||
|
||||
/**
|
||||
* Whether to show the access status badge or not
|
||||
*/
|
||||
showAccessStatus: boolean;
|
||||
|
||||
ngOnInit(): void {
|
||||
this.showAccessStatus = environment.ui.showAccessStatuses;
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<div class="d-flex">
|
||||
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
|
||||
<ds-access-status-badge *ngIf="showAccessStatus" [uuid]="dso.uuid"></ds-access-status-badge>
|
||||
<ds-access-status-badge *ngIf="showAccessStatus" [uuid]="dso.uuid" class="pl-1"></ds-access-status-badge>
|
||||
</div>
|
||||
|
||||
<ds-truncatable [id]="dso.id" *ngIf="object !== undefined && object !== null">
|
||||
|
Reference in New Issue
Block a user