mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-12 04:23:04 +00:00
#150 Moved list,grid and object-collection to shared package
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
<a [routerLink]="['/collections/' + dso.id]" class="lead" [innerHTML]="getFirstValue('dc.title')"></a>
|
||||
<div *ngIf="dso.shortDescription" class="text-muted" [innerHTML]="getFirstValue('dc.description.abstract')"></div>
|
@@ -0,0 +1,2 @@
|
||||
@import '../../../../../styles/variables';
|
||||
@import '../../grid-card-styling';
|
@@ -0,0 +1,17 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
import { renderElementsFor} from '../../../object-collection/shared/dso-element-decorator';
|
||||
|
||||
import { CollectionSearchResult } from './collection-search-result.model';
|
||||
import { SearchResultGridElementComponent } from '../search-result-grid-element.component';
|
||||
import { Collection } from '../../../../core/shared/collection.model';
|
||||
import { ViewMode } from '../../../../+search-page/search-options.model';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-collection-search-result-grid-element',
|
||||
styleUrls: ['../search-result-grid-element.component.scss', 'collection-search-result-grid-element.component.scss'],
|
||||
templateUrl: 'collection-search-result-grid-element.component.html'
|
||||
})
|
||||
|
||||
@renderElementsFor(CollectionSearchResult, ViewMode.Grid)
|
||||
export class CollectionSearchResultGridElementComponent extends SearchResultGridElementComponent<CollectionSearchResult, Collection> {}
|
@@ -0,0 +1,5 @@
|
||||
import { SearchResult } from '../../../../+search-page/search-result.model';
|
||||
import { Collection } from '../../../../core/shared/collection.model';
|
||||
|
||||
export class CollectionSearchResult extends SearchResult<Collection> {
|
||||
}
|
@@ -0,0 +1,2 @@
|
||||
<a [routerLink]="['/communities/' + dso.id]" class="lead" [innerHTML]="getFirstValue('dc.title')"></a>
|
||||
<div *ngIf="dso.shortDescription" class="text-muted" [innerHTML]="getFirstValue('dc.description.abstract')"></div>
|
@@ -0,0 +1,2 @@
|
||||
@import '../../../../../styles/variables';
|
||||
@import '../../grid-card-styling';
|
@@ -0,0 +1,18 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
import { CommunitySearchResult } from './community-search-result.model';
|
||||
import { Community } from '../../../../core/shared/community.model';
|
||||
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
|
||||
import { SearchResultGridElementComponent } from '../search-result-grid-element.component';
|
||||
import { ViewMode } from '../../../../+search-page/search-options.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'
|
||||
})
|
||||
|
||||
@renderElementsFor(CommunitySearchResult, ViewMode.Grid)
|
||||
export class CommunitySearchResultGridElementComponent extends SearchResultGridElementComponent<CommunitySearchResult, Community> {
|
||||
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
import { SearchResult } from '../../../../+search-page/search-result.model';
|
||||
import { Community } from '../../../../core/shared/community.model';
|
||||
|
||||
export class CommunitySearchResult extends SearchResult<Community> {
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
<div class="card">
|
||||
<a [routerLink]="['/items/' + dso.id]" class="card-img-top">
|
||||
<ds-grid-thumbnail [thumbnail]="dso.getThumbnail()">
|
||||
</ds-grid-thumbnail>
|
||||
</a>
|
||||
<div class="card-block">
|
||||
<p class="card-title" [innerHTML]="dso.findMetadata('dc.title')"></p>
|
||||
|
||||
<p *ngIf="dso.filterMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*'])"
|
||||
class="item-authors card-text text-muted">
|
||||
<span
|
||||
*ngFor="let authorMd of dso.filterMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']); let first=first;">
|
||||
<span *ngIf="first" [innerHTML]="authorMd.value">
|
||||
<span
|
||||
*ngIf="dso.filterMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']).length>1">, ...</span>
|
||||
</span>
|
||||
</span>
|
||||
<span *ngIf="dso.findMetadata('dc.date.issued')"
|
||||
class="item-list-date">
|
||||
<span *ngIf="dso.filterMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']).length>1">,</span>
|
||||
{{dso.findMetadata("dc.date.issued")}}</span>
|
||||
|
||||
|
||||
</p>
|
||||
<p class="item-abstract card-text" [innerHTML]="getFirstValue('dc.description.abstract') | dsTruncate:[200]">
|
||||
</p>
|
||||
|
||||
<a [routerLink]="['/items/' + dso.id]" class="lead btn btn-primary viewButton">View</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@@ -0,0 +1,2 @@
|
||||
@import '../../../../../styles/variables';
|
||||
@import '../../grid-card-styling';
|
@@ -0,0 +1,16 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
|
||||
import { SearchResultGridElementComponent } from '../search-result-grid-element.component';
|
||||
import { Item } from '../../../../core/shared/item.model';
|
||||
import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model';
|
||||
import { ViewMode } from '../../../../+search-page/search-options.model';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-item-search-result-grid-element',
|
||||
styleUrls: ['../search-result-grid-element.component.scss', 'item-search-result-grid-element.component.scss'],
|
||||
templateUrl: 'item-search-result-grid-element.component.html'
|
||||
})
|
||||
|
||||
@renderElementsFor(ItemSearchResult, ViewMode.Grid)
|
||||
export class ItemSearchResultGridElementComponent extends SearchResultGridElementComponent<ItemSearchResult, Item> {}
|
@@ -0,0 +1,8 @@
|
||||
@import '../../../../styles/variables';
|
||||
@import '../grid-card-styling';
|
||||
:host {
|
||||
/deep/ em {
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
}
|
||||
}
|
@@ -0,0 +1,57 @@
|
||||
import { Component, Inject } from '@angular/core';
|
||||
|
||||
import { SearchResult } from '../../../+search-page/search-result.model';
|
||||
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
||||
import { Metadatum } from '../../../core/shared/metadatum.model';
|
||||
import { isEmpty, hasNoValue } from '../../empty.util';
|
||||
import { ObjectGridElementComponent } from '../object-grid-element/object-grid-element.component';
|
||||
import { ListableObject } from '../../object-collection/shared/listable-object.model';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-search-result-grid-element',
|
||||
template: ``
|
||||
})
|
||||
|
||||
export class SearchResultGridElementComponent<T extends SearchResult<K>, K extends DSpaceObject> extends ObjectGridElementComponent<T> {
|
||||
dso: K;
|
||||
|
||||
public constructor(@Inject('objectElementProvider') public gridable: ListableObject) {
|
||||
super(gridable);
|
||||
this.dso = this.object.dspaceObject;
|
||||
}
|
||||
|
||||
getValues(keys: string[]): string[] {
|
||||
const results: string[] = new Array<string>();
|
||||
this.object.hitHighlights.forEach(
|
||||
(md: Metadatum) => {
|
||||
if (keys.indexOf(md.key) > -1) {
|
||||
results.push(md.value);
|
||||
}
|
||||
}
|
||||
);
|
||||
if (isEmpty(results)) {
|
||||
this.dso.filterMetadata(keys).forEach(
|
||||
(md: Metadatum) => {
|
||||
results.push(md.value);
|
||||
}
|
||||
);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
getFirstValue(key: string): string {
|
||||
let result: string;
|
||||
this.object.hitHighlights.some(
|
||||
(md: Metadatum) => {
|
||||
if (key === md.key) {
|
||||
result = md.value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
);
|
||||
if (hasNoValue(result)) {
|
||||
result = this.dso.findMetadata(key);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user