mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-13 13:03:04 +00:00
Merge remote-tracking branch 'upstream/main' into w2p-74199_Admin-search-dialogs
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
<div class="card">
|
||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/collections/', dso.id]" class="card-img-top">
|
||||
<ds-grid-thumbnail [thumbnail]="dso.logo">
|
||||
<ds-grid-thumbnail [thumbnail]="(dso.logo | async)?.payload">
|
||||
</ds-grid-thumbnail>
|
||||
</a>
|
||||
<span *ngIf="linkType == linkTypes.None" class="card-img-top">
|
||||
<ds-grid-thumbnail [thumbnail]="dso.logo">
|
||||
<ds-grid-thumbnail [thumbnail]="(dso.logo | async)?.payload">
|
||||
</ds-grid-thumbnail>
|
||||
</span>
|
||||
<div class="card-body">
|
||||
|
@@ -19,6 +19,7 @@ import { TruncatableService } from '../../../truncatable/truncatable.service';
|
||||
import { TruncatePipe } from '../../../utils/truncate.pipe';
|
||||
import { CollectionSearchResultGridElementComponent } from './collection-search-result-grid-element.component';
|
||||
import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service';
|
||||
import { LinkService } from '../../../../core/cache/builders/link.service';
|
||||
|
||||
let collectionSearchResultGridElementComponent: CollectionSearchResultGridElementComponent;
|
||||
let fixture: ComponentFixture<CollectionSearchResultGridElementComponent>;
|
||||
@@ -52,6 +53,9 @@ mockCollectionWithoutAbstract.indexableObject = Object.assign(new Collection(),
|
||||
]
|
||||
}
|
||||
});
|
||||
const linkService = jasmine.createSpyObj('linkService', {
|
||||
resolveLink: mockCollectionWithAbstract
|
||||
});
|
||||
|
||||
describe('CollectionSearchResultGridElementComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
@@ -72,6 +76,7 @@ describe('CollectionSearchResultGridElementComponent', () => {
|
||||
{ provide: DSOChangeAnalyzer, useValue: {} },
|
||||
{ provide: DefaultChangeAnalyzer, useValue: {} },
|
||||
{ provide: BitstreamFormatDataService, useValue: {} },
|
||||
{ provide: LinkService, useValue: linkService}
|
||||
],
|
||||
|
||||
schemas: [ NO_ERRORS_SCHEMA ]
|
||||
|
@@ -1,10 +1,14 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { SearchResultGridElementComponent } from '../search-result-grid-element.component';
|
||||
import { Collection } from '../../../../core/shared/collection.model';
|
||||
import { CollectionSearchResult } from '../../../object-collection/shared/collection-search-result.model';
|
||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||
import { hasNoValue, hasValue } from '../../../empty.util';
|
||||
import { followLink } from '../../../utils/follow-link-config.model';
|
||||
import { LinkService } from '../../../../core/cache/builders/link.service';
|
||||
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
||||
import { BitstreamDataService } from '../../../../core/data/bitstream-data.service';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-collection-search-result-grid-element',
|
||||
@@ -15,4 +19,28 @@ import { listableObjectComponent } from '../../../object-collection/shared/lista
|
||||
* Component representing a grid element for a collection search result
|
||||
*/
|
||||
@listableObjectComponent(CollectionSearchResult, ViewMode.GridElement)
|
||||
export class CollectionSearchResultGridElementComponent extends SearchResultGridElementComponent<CollectionSearchResult, Collection> {}
|
||||
export class CollectionSearchResultGridElementComponent extends SearchResultGridElementComponent< CollectionSearchResult, Collection > {
|
||||
private _dso: Collection;
|
||||
|
||||
constructor(
|
||||
private linkService: LinkService,
|
||||
protected truncatableService: TruncatableService,
|
||||
protected bitstreamDataService: BitstreamDataService
|
||||
) {
|
||||
super(truncatableService, bitstreamDataService);
|
||||
}
|
||||
|
||||
@Input() set dso(dso: Collection) {
|
||||
this._dso = dso;
|
||||
if (hasValue(this._dso) && hasNoValue(this._dso.logo)) {
|
||||
this.linkService.resolveLink<Collection>(
|
||||
this._dso,
|
||||
followLink('logo')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
get dso(): Collection {
|
||||
return this._dso;
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +1,10 @@
|
||||
<div class="card">
|
||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/communities/', dso.id]" class="card-img-top">
|
||||
<ds-grid-thumbnail [thumbnail]="dso.logo">
|
||||
<ds-grid-thumbnail [thumbnail]="(dso.logo | async)?.payload">
|
||||
</ds-grid-thumbnail>
|
||||
</a>
|
||||
<span *ngIf="linkType == linkTypes.None" class="card-img-top">
|
||||
<ds-grid-thumbnail [thumbnail]="dso.logo">
|
||||
<ds-grid-thumbnail [thumbnail]="(dso.logo | async)?.payload">
|
||||
</ds-grid-thumbnail>
|
||||
</span>
|
||||
<div class="card-body">
|
||||
|
@@ -19,6 +19,7 @@ import { TruncatableService } from '../../../truncatable/truncatable.service';
|
||||
import { TruncatePipe } from '../../../utils/truncate.pipe';
|
||||
import { CommunitySearchResultGridElementComponent } from './community-search-result-grid-element.component';
|
||||
import { BitstreamFormatDataService } from '../../../../core/data/bitstream-format-data.service';
|
||||
import { LinkService } from '../../../../core/cache/builders/link.service';
|
||||
|
||||
let communitySearchResultGridElementComponent: CommunitySearchResultGridElementComponent;
|
||||
let fixture: ComponentFixture<CommunitySearchResultGridElementComponent>;
|
||||
@@ -52,6 +53,9 @@ mockCommunityWithoutAbstract.indexableObject = Object.assign(new Community(), {
|
||||
]
|
||||
}
|
||||
});
|
||||
const linkService = jasmine.createSpyObj('linkService', {
|
||||
resolveLink: mockCommunityWithAbstract
|
||||
});
|
||||
|
||||
describe('CommunitySearchResultGridElementComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
@@ -72,6 +76,7 @@ describe('CommunitySearchResultGridElementComponent', () => {
|
||||
{ provide: DSOChangeAnalyzer, useValue: {} },
|
||||
{ provide: DefaultChangeAnalyzer, useValue: {} },
|
||||
{ provide: BitstreamFormatDataService, useValue: {} },
|
||||
{ provide: LinkService, useValue: linkService}
|
||||
],
|
||||
|
||||
schemas: [ NO_ERRORS_SCHEMA ]
|
||||
|
@@ -1,18 +1,46 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { Community } from '../../../../core/shared/community.model';
|
||||
import { SearchResultGridElementComponent } from '../search-result-grid-element.component';
|
||||
import { CommunitySearchResult } from '../../../object-collection/shared/community-search-result.model';
|
||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||
import { LinkService } from '../../../../core/cache/builders/link.service';
|
||||
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
||||
import { BitstreamDataService } from '../../../../core/data/bitstream-data.service';
|
||||
import { hasNoValue, hasValue } from '../../../empty.util';
|
||||
import { followLink } from '../../../utils/follow-link-config.model';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-community-search-result-grid-element',
|
||||
styleUrls: ['../search-result-grid-element.component.scss', 'community-search-result-grid-element.component.scss'],
|
||||
templateUrl: 'community-search-result-grid-element.component.html'
|
||||
styleUrls: [
|
||||
'../search-result-grid-element.component.scss',
|
||||
'community-search-result-grid-element.component.scss',
|
||||
],
|
||||
templateUrl: 'community-search-result-grid-element.component.html',
|
||||
})
|
||||
/**
|
||||
* Component representing a grid element for a community search result
|
||||
*/
|
||||
@listableObjectComponent(CommunitySearchResult, ViewMode.GridElement)
|
||||
export class CommunitySearchResultGridElementComponent extends SearchResultGridElementComponent<CommunitySearchResult, Community> {
|
||||
export class CommunitySearchResultGridElementComponent extends SearchResultGridElementComponent<CommunitySearchResult,Community> {
|
||||
private _dso: Community;
|
||||
|
||||
constructor(
|
||||
private linkService: LinkService,
|
||||
protected truncatableService: TruncatableService,
|
||||
protected bitstreamDataService: BitstreamDataService
|
||||
) {
|
||||
super(truncatableService, bitstreamDataService);
|
||||
}
|
||||
|
||||
@Input() set dso(dso: Community) {
|
||||
this._dso = dso;
|
||||
if (hasValue(this._dso) && hasNoValue(this._dso.logo)) {
|
||||
this.linkService.resolveLink<Community>(this._dso, followLink('logo'));
|
||||
}
|
||||
}
|
||||
|
||||
get dso(): Community {
|
||||
return this._dso;
|
||||
}
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@
|
||||
</a>
|
||||
<span *ngIf="linkType == linkTypes.None" class="card-img-top full-width">
|
||||
<div>
|
||||
<ds-grid-thumbnail [thumbnail]="getThumbnail() | async">
|
||||
<ds-grid-thumbnail [thumbnail]="getThumbnail() | async">
|
||||
</ds-grid-thumbnail>
|
||||
</div>
|
||||
</span>
|
||||
|
@@ -6,10 +6,10 @@ import { BitstreamDataService } from '../../../core/data/bitstream-data.service'
|
||||
import { Bitstream } from '../../../core/shared/bitstream.model';
|
||||
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
||||
import { Metadata } from '../../../core/shared/metadata.utils';
|
||||
import { getFirstSucceededRemoteDataPayload } from '../../../core/shared/operators';
|
||||
import { hasValue } from '../../empty.util';
|
||||
import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
|
||||
import { TruncatableService } from '../../truncatable/truncatable.service';
|
||||
import { getFirstSucceededRemoteDataPayload } from '../../../core/shared/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-search-result-grid-element',
|
||||
|
Reference in New Issue
Block a user