mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-13 13:03:04 +00:00
Merge remote-tracking branch 'remotes/origin/main' into upgrade_angular10
# Conflicts: # package.json # server.ts # src/app/+admin/admin-access-control/epeople-registry/epeople-registry.component.ts # src/app/+admin/admin-access-control/group-registry/group-form/group-form.component.ts # src/app/+admin/admin-access-control/group-registry/groups-registry.component.spec.ts # src/app/+admin/admin-access-control/group-registry/groups-registry.component.ts # src/app/+collection-page/collection-page.component.ts # src/app/+item-page/edit-item-page/item-page-reinstate.guard.ts # src/app/+item-page/edit-item-page/item-page-withdraw.guard.ts # src/app/+item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.ts # src/app/+item-page/edit-item-page/item-relationships/item-relationships.component.ts # src/app/+item-page/item-page-administrator.guard.ts # src/app/app-routing.module.ts # src/app/community-list-page/community-list-service.ts # src/app/core/data/entity-type.service.ts # src/app/core/data/feature-authorization/feature-authorization-guard/dso-page-feature.guard.spec.ts # src/app/core/data/feature-authorization/feature-authorization-guard/feature-authorization.guard.spec.ts # src/app/core/data/feature-authorization/feature-authorization-guard/feature-authorization.guard.ts # src/app/core/data/feature-authorization/feature-authorization-guard/site-administrator.guard.ts # src/app/core/data/feature-authorization/feature-authorization-guard/site-register.guard.ts # src/app/core/data/object-updates/object-updates.reducer.ts # src/app/core/shared/operators.ts # src/app/process-page/detail/process-detail.component.ts # src/app/shared/comcol-forms/delete-comcol-page/delete-comcol-page.component.ts # src/app/shared/dso-selector/dso-selector/dso-selector.component.ts # src/app/shared/input-suggestions/filter-suggestions/filter-input-suggestions.component.ts # src/app/shared/object-grid/grid-thumbnail/grid-thumbnail.component.ts # src/app/shared/shared.module.ts # yarn.lock
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/', object.id]" class="card-img-top">
|
||||
<ds-grid-thumbnail [thumbnail]="object.logo">
|
||||
<ds-grid-thumbnail [thumbnail]="(object.logo | async)?.payload">
|
||||
</ds-grid-thumbnail>
|
||||
</a>
|
||||
<span *ngIf="linkType == linkTypes.None" class="card-img-top">
|
||||
<ds-grid-thumbnail [thumbnail]="object.logo">
|
||||
<ds-grid-thumbnail [thumbnail]="(object.logo | async)?.payload">
|
||||
</ds-grid-thumbnail>
|
||||
</span>
|
||||
<div class="card-body">
|
||||
|
@@ -3,6 +3,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { Collection } from '../../../core/shared/collection.model';
|
||||
import { LinkService } from '../../../core/cache/builders/link.service';
|
||||
|
||||
let collectionGridElementComponent: CollectionGridElementComponent;
|
||||
let fixture: ComponentFixture<CollectionGridElementComponent>;
|
||||
@@ -29,12 +30,17 @@ const mockCollectionWithoutAbstract: Collection = Object.assign(new Collection()
|
||||
}
|
||||
});
|
||||
|
||||
const linkService = jasmine.createSpyObj('linkService', {
|
||||
resolveLink: mockCollectionWithAbstract
|
||||
});
|
||||
|
||||
describe('CollectionGridElementComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CollectionGridElementComponent ],
|
||||
providers: [
|
||||
{ provide: 'objectElementProvider', useValue: (mockCollectionWithAbstract)}
|
||||
{ provide: 'objectElementProvider', useValue: (mockCollectionWithAbstract)},
|
||||
{ provide: LinkService, useValue: linkService}
|
||||
],
|
||||
|
||||
schemas: [ NO_ERRORS_SCHEMA ]
|
||||
|
@@ -1,9 +1,11 @@
|
||||
import { Component, Inject } from '@angular/core';
|
||||
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { Collection } from '../../../core/shared/collection.model';
|
||||
import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
|
||||
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';
|
||||
|
||||
/**
|
||||
* Component representing a grid element for collection
|
||||
@@ -11,8 +13,29 @@ import { listableObjectComponent } from '../../object-collection/shared/listable
|
||||
@Component({
|
||||
selector: 'ds-collection-grid-element',
|
||||
styleUrls: ['./collection-grid-element.component.scss'],
|
||||
templateUrl: './collection-grid-element.component.html'
|
||||
templateUrl: './collection-grid-element.component.html',
|
||||
})
|
||||
|
||||
@listableObjectComponent(Collection, ViewMode.GridElement)
|
||||
export class CollectionGridElementComponent extends AbstractListableElementComponent<Collection> {}
|
||||
export class CollectionGridElementComponent extends AbstractListableElementComponent<
|
||||
Collection
|
||||
> {
|
||||
private _object: Collection;
|
||||
|
||||
constructor(private linkService: LinkService) {
|
||||
super();
|
||||
}
|
||||
|
||||
@Input() set object(object: Collection) {
|
||||
this._object = object;
|
||||
if (hasValue(this._object) && hasNoValue(this._object.logo)) {
|
||||
this.linkService.resolveLink<Collection>(
|
||||
this._object,
|
||||
followLink('logo')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
get object(): Collection {
|
||||
return this._object;
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +1,10 @@
|
||||
<div class="card">
|
||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/communities/', object.id]" class="card-img-top">
|
||||
<ds-grid-thumbnail [thumbnail]="object.logo">
|
||||
<ds-grid-thumbnail [thumbnail]="(object.logo | async)?.payload">
|
||||
</ds-grid-thumbnail>
|
||||
</a>
|
||||
<span *ngIf="linkType == linkTypes.None" class="card-img-top">
|
||||
<ds-grid-thumbnail [thumbnail]="object.logo">
|
||||
<ds-grid-thumbnail [thumbnail]="(object.logo | async)?.payload">
|
||||
</ds-grid-thumbnail>
|
||||
</span>
|
||||
<div class="card-body">
|
||||
|
@@ -3,6 +3,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { Community } from '../../../core/shared/community.model';
|
||||
import { LinkService } from '../../../core/cache/builders/link.service';
|
||||
|
||||
let communityGridElementComponent: CommunityGridElementComponent;
|
||||
let fixture: ComponentFixture<CommunityGridElementComponent>;
|
||||
@@ -29,12 +30,17 @@ const mockCommunityWithoutAbstract: Community = Object.assign(new Community(), {
|
||||
}
|
||||
});
|
||||
|
||||
const linkService = jasmine.createSpyObj('linkService', {
|
||||
resolveLink: mockCommunityWithAbstract
|
||||
});
|
||||
|
||||
describe('CommunityGridElementComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CommunityGridElementComponent ],
|
||||
providers: [
|
||||
{ provide: 'objectElementProvider', useValue: (mockCommunityWithAbstract)}
|
||||
{ provide: 'objectElementProvider', useValue: (mockCommunityWithAbstract)},
|
||||
{ provide: LinkService, useValue: linkService}
|
||||
],
|
||||
|
||||
schemas: [ NO_ERRORS_SCHEMA ]
|
||||
|
@@ -1,9 +1,11 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { Community } from '../../../core/shared/community.model';
|
||||
import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
|
||||
import { ViewMode } from '../../../core/shared/view-mode.model';
|
||||
import { listableObjectComponent } from '../../object-collection/shared/listable-object/listable-object.decorator';
|
||||
import { followLink } from '../../utils/follow-link-config.model';
|
||||
import { LinkService } from '../../../core/cache/builders/link.service';
|
||||
import { hasNoValue, hasValue } from '../../empty.util';
|
||||
|
||||
/**
|
||||
* Component representing a grid element for a community
|
||||
@@ -15,4 +17,21 @@ import { listableObjectComponent } from '../../object-collection/shared/listable
|
||||
})
|
||||
|
||||
@listableObjectComponent(Community, ViewMode.GridElement)
|
||||
export class CommunityGridElementComponent extends AbstractListableElementComponent<Community> {}
|
||||
export class CommunityGridElementComponent extends AbstractListableElementComponent<Community> {
|
||||
private _object: Community;
|
||||
|
||||
constructor( private linkService: LinkService) {
|
||||
super();
|
||||
}
|
||||
|
||||
@Input() set object(object: Community) {
|
||||
this._object = object;
|
||||
if (hasValue(this._object) && hasNoValue(this._object.logo)) {
|
||||
this.linkService.resolveLink<Community>(this._object, followLink('logo'))
|
||||
}
|
||||
}
|
||||
|
||||
get object(): Community {
|
||||
return this._object;
|
||||
}
|
||||
}
|
||||
|
@@ -1,3 +1,3 @@
|
||||
<div class="thumbnail">
|
||||
<img [src]="src | dsSafeUrl" (error)="errorHandler($event)"/>
|
||||
<img [src]="src | dsSafeUrl" (error)="errorHandler($event)" />
|
||||
</div>
|
||||
|
@@ -1,4 +1,10 @@
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import {
|
||||
Component,
|
||||
Input,
|
||||
OnChanges,
|
||||
OnInit,
|
||||
SimpleChanges,
|
||||
} from '@angular/core';
|
||||
import { Bitstream } from '../../../core/shared/bitstream.model';
|
||||
import { hasValue } from '../../empty.util';
|
||||
|
||||
@@ -11,10 +17,9 @@ import { hasValue } from '../../empty.util';
|
||||
@Component({
|
||||
selector: 'ds-grid-thumbnail',
|
||||
styleUrls: ['./grid-thumbnail.component.scss'],
|
||||
templateUrl: './grid-thumbnail.component.html'
|
||||
templateUrl: './grid-thumbnail.component.html',
|
||||
})
|
||||
export class GridThumbnailComponent implements OnInit {
|
||||
|
||||
export class GridThumbnailComponent implements OnInit, OnChanges {
|
||||
@Input() thumbnail: Bitstream;
|
||||
|
||||
data: any = {};
|
||||
@@ -22,19 +27,47 @@ export class GridThumbnailComponent implements OnInit {
|
||||
/**
|
||||
* The default 'holder.js' image
|
||||
*/
|
||||
@Input() defaultImage? = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMjYwIiBoZWlnaHQ9IjE4MCIgdmlld0JveD0iMCAwIDI2MCAxODAiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiPjwhLS0KU291cmNlIFVSTDogaG9sZGVyLmpzLzEwMCV4MTgwL3RleHQ6Tm8gVGh1bWJuYWlsCkNyZWF0ZWQgd2l0aCBIb2xkZXIuanMgMi42LjAuCkxlYXJuIG1vcmUgYXQgaHR0cDovL2hvbGRlcmpzLmNvbQooYykgMjAxMi0yMDE1IEl2YW4gTWFsb3BpbnNreSAtIGh0dHA6Ly9pbXNreS5jbwotLT48ZGVmcz48c3R5bGUgdHlwZT0idGV4dC9jc3MiPjwhW0NEQVRBWyNob2xkZXJfMTVmNzJmMmFlMGIgdGV4dCB7IGZpbGw6I0FBQUFBQTtmb250LXdlaWdodDpib2xkO2ZvbnQtZmFtaWx5OkFyaWFsLCBIZWx2ZXRpY2EsIE9wZW4gU2Fucywgc2Fucy1zZXJpZiwgbW9ub3NwYWNlO2ZvbnQtc2l6ZToxM3B0IH0gXV0+PC9zdHlsZT48L2RlZnM+PGcgaWQ9ImhvbGRlcl8xNWY3MmYyYWUwYiI+PHJlY3Qgd2lkdGg9IjI2MCIgaGVpZ2h0PSIxODAiIGZpbGw9IiNFRUVFRUUiLz48Zz48dGV4dCB4PSI3Mi4yNDIxODc1IiB5PSI5NiI+Tm8gVGh1bWJuYWlsPC90ZXh0PjwvZz48L2c+PC9zdmc+';
|
||||
@Input() defaultImage? =
|
||||
'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9InllcyI/PjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMjYwIiBoZWlnaHQ9IjE4MCIgdmlld0JveD0iMCAwIDI2MCAxODAiIHByZXNlcnZlQXNwZWN0UmF0aW89Im5vbmUiPjwhLS0KU291cmNlIFVSTDogaG9sZGVyLmpzLzEwMCV4MTgwL3RleHQ6Tm8gVGh1bWJuYWlsCkNyZWF0ZWQgd2l0aCBIb2xkZXIuanMgMi42LjAuCkxlYXJuIG1vcmUgYXQgaHR0cDovL2hvbGRlcmpzLmNvbQooYykgMjAxMi0yMDE1IEl2YW4gTWFsb3BpbnNreSAtIGh0dHA6Ly9pbXNreS5jbwotLT48ZGVmcz48c3R5bGUgdHlwZT0idGV4dC9jc3MiPjwhW0NEQVRBWyNob2xkZXJfMTVmNzJmMmFlMGIgdGV4dCB7IGZpbGw6I0FBQUFBQTtmb250LXdlaWdodDpib2xkO2ZvbnQtZmFtaWx5OkFyaWFsLCBIZWx2ZXRpY2EsIE9wZW4gU2Fucywgc2Fucy1zZXJpZiwgbW9ub3NwYWNlO2ZvbnQtc2l6ZToxM3B0IH0gXV0+PC9zdHlsZT48L2RlZnM+PGcgaWQ9ImhvbGRlcl8xNWY3MmYyYWUwYiI+PHJlY3Qgd2lkdGg9IjI2MCIgaGVpZ2h0PSIxODAiIGZpbGw9IiNFRUVFRUUiLz48Zz48dGV4dCB4PSI3Mi4yNDIxODc1IiB5PSI5NiI+Tm8gVGh1bWJuYWlsPC90ZXh0PjwvZz48L2c+PC9zdmc+';
|
||||
|
||||
src: string;
|
||||
|
||||
errorHandler(event) {
|
||||
event.currentTarget.src = this.defaultImage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the src
|
||||
*/
|
||||
ngOnInit(): void {
|
||||
if (hasValue(this.thumbnail) && hasValue(this.thumbnail._links) && this.thumbnail._links.content.href) {
|
||||
this.src = this.thumbnail._links.content.href;
|
||||
} else {
|
||||
this.src = this.defaultImage;
|
||||
this.src = this.defaultImage;
|
||||
|
||||
this.checkThumbnail(this.thumbnail);
|
||||
}
|
||||
|
||||
/**
|
||||
* If the old input is undefined and the new one is a bitsream then set src
|
||||
*/
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
if (
|
||||
!hasValue(changes.thumbnail.previousValue) &&
|
||||
hasValue(changes.thumbnail.currentValue)
|
||||
) {
|
||||
console.log('this.thumbnail', changes.thumbnail.currentValue);
|
||||
this.checkThumbnail(changes.thumbnail.currentValue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* check if the Bitstream has any content than set the src
|
||||
*/
|
||||
checkThumbnail(thumbnail: Bitstream) {
|
||||
if (
|
||||
hasValue(thumbnail) &&
|
||||
hasValue(thumbnail._links) &&
|
||||
thumbnail._links.content.href
|
||||
) {
|
||||
this.src = thumbnail._links.content.href;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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