mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-13 21:13:07 +00:00
47 lines
1.9 KiB
TypeScript
47 lines
1.9 KiB
TypeScript
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',
|
|
})
|
|
/**
|
|
* Component representing a grid element for a community search result
|
|
*/
|
|
@listableObjectComponent(CommunitySearchResult, ViewMode.GridElement)
|
|
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;
|
|
}
|
|
}
|