diff --git a/src/app/+item-page/item-page.module.ts b/src/app/+item-page/item-page.module.ts index fdf9d19674..62253a3183 100644 --- a/src/app/+item-page/item-page.module.ts +++ b/src/app/+item-page/item-page.module.ts @@ -23,7 +23,6 @@ import { ItemPageFieldsComponent } from './simple/entity-types/item/item-page-fi import { OrgUnitPageFieldsComponent } from './simple/entity-types/orgunit/orgunit-page-fields.component'; import { PersonPageFieldsComponent } from './simple/entity-types/person/person-page-fields.component'; import { ProjectPageFieldsComponent } from './simple/entity-types/project/project-page-fields.component'; -import { EntityTypeSwitcherComponent } from './simple/entity-types/switcher/entity-type-switcher.component'; @NgModule({ imports: [ @@ -46,7 +45,6 @@ import { EntityTypeSwitcherComponent } from './simple/entity-types/switcher/enti FileSectionComponent, CollectionsComponent, FullFileSectionComponent, - EntityTypeSwitcherComponent, ItemPageFieldsComponent, ProjectPageFieldsComponent, OrgUnitPageFieldsComponent, diff --git a/src/app/+item-page/simple/entity-types/item/item-page-fields.component.ts b/src/app/+item-page/simple/entity-types/item/item-page-fields.component.ts index 90504812d7..4a5469c3c2 100644 --- a/src/app/+item-page/simple/entity-types/item/item-page-fields.component.ts +++ b/src/app/+item-page/simple/entity-types/item/item-page-fields.component.ts @@ -5,7 +5,7 @@ import { rendersEntityType } from '../../../../shared/entities/entity-type-decorator'; import { ElementViewMode } from '../../../../shared/view-mode'; -import { ITEM } from '../switcher/entity-type-switcher.component'; +import { ITEM } from '../../../../shared/entities/switcher/entity-type-switcher.component'; @rendersEntityType('Item', ElementViewMode.Full) @rendersEntityType(DEFAULT_ENTITY_TYPE, ElementViewMode.Full) diff --git a/src/app/+item-page/simple/entity-types/orgunit/orgunit-page-fields.component.ts b/src/app/+item-page/simple/entity-types/orgunit/orgunit-page-fields.component.ts index 97a0d4f477..74e75e1dc9 100644 --- a/src/app/+item-page/simple/entity-types/orgunit/orgunit-page-fields.component.ts +++ b/src/app/+item-page/simple/entity-types/orgunit/orgunit-page-fields.component.ts @@ -2,7 +2,7 @@ import { Component, Inject } from '@angular/core'; import { Item } from '../../../../core/shared/item.model'; import { rendersEntityType } from '../../../../shared/entities/entity-type-decorator'; import { ElementViewMode } from '../../../../shared/view-mode'; -import { ITEM } from '../switcher/entity-type-switcher.component'; +import { ITEM } from '../../../../shared/entities/switcher/entity-type-switcher.component'; @rendersEntityType('OrgUnit', ElementViewMode.Full) @Component({ diff --git a/src/app/+item-page/simple/entity-types/person/person-page-fields.component.ts b/src/app/+item-page/simple/entity-types/person/person-page-fields.component.ts index 058ca8a7cc..dce8fe5dbe 100644 --- a/src/app/+item-page/simple/entity-types/person/person-page-fields.component.ts +++ b/src/app/+item-page/simple/entity-types/person/person-page-fields.component.ts @@ -11,7 +11,7 @@ import { getRemoteDataPayload } from '../../../../core/shared/operators'; import { hasValue } from '../../../../shared/empty.util'; import { rendersEntityType } from '../../../../shared/entities/entity-type-decorator'; import { ElementViewMode } from '../../../../shared/view-mode'; -import { ITEM } from '../switcher/entity-type-switcher.component'; +import { ITEM } from '../../../../shared/entities/switcher/entity-type-switcher.component'; const compareArraysUsing = (mapFn: (t: T) => any) => (a: T[], b: T[]): boolean => { @@ -63,7 +63,6 @@ const relationsToItems = (thisId: string, ids: ItemDataService) => distinctUntilChanged(compareArraysUsingIds()), ); - @rendersEntityType('Person', ElementViewMode.Full) @Component({ selector: 'ds-person-page-fields', diff --git a/src/app/+item-page/simple/entity-types/project/project-page-fields.component.ts b/src/app/+item-page/simple/entity-types/project/project-page-fields.component.ts index f6e93dcfa6..d648247a58 100644 --- a/src/app/+item-page/simple/entity-types/project/project-page-fields.component.ts +++ b/src/app/+item-page/simple/entity-types/project/project-page-fields.component.ts @@ -2,7 +2,7 @@ import { Component, Inject } from '@angular/core'; import { Item } from '../../../../core/shared/item.model'; import { rendersEntityType } from '../../../../shared/entities/entity-type-decorator'; import { ElementViewMode } from '../../../../shared/view-mode'; -import { ITEM } from '../switcher/entity-type-switcher.component'; +import { ITEM } from '../../../../shared/entities/switcher/entity-type-switcher.component'; @rendersEntityType('Project', ElementViewMode.Full) @Component({ diff --git a/src/app/+item-page/simple/entity-types/switcher/entity-type-switcher.component.scss b/src/app/+item-page/simple/entity-types/switcher/entity-type-switcher.component.scss deleted file mode 100644 index 3575cae797..0000000000 --- a/src/app/+item-page/simple/entity-types/switcher/entity-type-switcher.component.scss +++ /dev/null @@ -1 +0,0 @@ -@import '../../../../../styles/variables.scss'; diff --git a/src/app/+item-page/simple/entity-types/switcher/entity-type-switcher.component.ts b/src/app/+item-page/simple/entity-types/switcher/entity-type-switcher.component.ts deleted file mode 100644 index d2e2374e8e..0000000000 --- a/src/app/+item-page/simple/entity-types/switcher/entity-type-switcher.component.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { Component, InjectionToken, Injector, Input, OnInit } from '@angular/core'; -import { GenericConstructor } from '../../../../core/shared/generic-constructor'; -import { Item } from '../../../../core/shared/item.model'; -import { getComponentByEntityType } from '../../../../shared/entities/entity-type-decorator'; -import { rendersDSOType } from '../../../../shared/object-collection/shared/dso-element-decorator'; -import { ListableObject } from '../../../../shared/object-collection/shared/listable-object.model'; -import { ElementViewMode, SetViewMode } from '../../../../shared/view-mode'; - -export const ITEM: InjectionToken = new InjectionToken('item'); - -@Component({ - selector: 'ds-entity-type-switcher', - styleUrls: ['./entity-type-switcher.component.scss'], - templateUrl: './entity-type-switcher.component.html' -}) -export class EntityTypeSwitcherComponent implements OnInit { - @Input() item: Item; - @Input() viewMode: ElementViewMode; - objectInjector: Injector; - - constructor(private injector: Injector) { - } - - ngOnInit(): void { - this.objectInjector = Injector.create({ - providers: [{ provide: ITEM, useFactory: () => this.item, deps:[] }], - parent: this.injector - }); - - } - - getComponent(): string { - const type = this.item.findMetadata('relationship.type'); - return getComponentByEntityType(type, this.viewMode); - } -} diff --git a/src/app/+item-page/simple/item-page.component.html b/src/app/+item-page/simple/item-page.component.html index 7c75887f38..17d271f368 100644 --- a/src/app/+item-page/simple/item-page.component.html +++ b/src/app/+item-page/simple/item-page.component.html @@ -1,7 +1,7 @@
- +
diff --git a/src/app/+search-page/search-result.model.ts b/src/app/+search-page/search-result.model.ts index cc2bd8cd58..2298f453e1 100644 --- a/src/app/+search-page/search-result.model.ts +++ b/src/app/+search-page/search-result.model.ts @@ -1,5 +1,6 @@ import { DSpaceObject } from '../core/shared/dspace-object.model'; import { Metadatum } from '../core/shared/metadatum.model'; +import { hasNoValue, isEmpty } from '../shared/empty.util'; import { ListableObject } from '../shared/object-collection/shared/listable-object.model'; export class SearchResult implements ListableObject { diff --git a/src/app/+item-page/simple/entity-types/switcher/entity-type-switcher.component.html b/src/app/shared/entities/switcher/entity-type-switcher.component.html similarity index 100% rename from src/app/+item-page/simple/entity-types/switcher/entity-type-switcher.component.html rename to src/app/shared/entities/switcher/entity-type-switcher.component.html diff --git a/src/app/shared/object-list/item-list-element/item-list-element.component.scss b/src/app/shared/entities/switcher/entity-type-switcher.component.scss similarity index 100% rename from src/app/shared/object-list/item-list-element/item-list-element.component.scss rename to src/app/shared/entities/switcher/entity-type-switcher.component.scss diff --git a/src/app/shared/entities/switcher/entity-type-switcher.component.ts b/src/app/shared/entities/switcher/entity-type-switcher.component.ts new file mode 100644 index 0000000000..a981f2665c --- /dev/null +++ b/src/app/shared/entities/switcher/entity-type-switcher.component.ts @@ -0,0 +1,44 @@ +import { Component, InjectionToken, Injector, Input, OnInit } from '@angular/core'; +import { SearchResult } from '../../../+search-page/search-result.model'; +import { Item } from '../../../core/shared/item.model'; +import { hasValue } from '../../empty.util'; +import { ItemSearchResult } from '../../object-collection/shared/item-search-result.model'; +import { getComponentByEntityType } from '../entity-type-decorator'; +import { ElementViewMode } from '../../view-mode'; + +export const ITEM: InjectionToken = new InjectionToken('item'); + +@Component({ + selector: 'ds-entity-type-switcher', + styleUrls: ['./entity-type-switcher.component.scss'], + templateUrl: './entity-type-switcher.component.html' +}) +export class EntityTypeSwitcherComponent implements OnInit { + @Input() object: Item | SearchResult; + @Input() viewMode: ElementViewMode; + objectInjector: Injector; + + constructor(private injector: Injector) { + } + + ngOnInit(): void { + this.objectInjector = Injector.create({ + providers: [{ provide: ITEM, useFactory: () => this.object, deps:[] }], + parent: this.injector + }); + + } + + getComponent(): string { + let item: Item; + if (hasValue((this.object as any).dspaceObject)) { + const searchResult = this.object as ItemSearchResult; + item = searchResult.dspaceObject; + } else { + item = this.object as Item; + } + + const type = item.findMetadata('relationship.type'); + return getComponentByEntityType(type, this.viewMode); + } +} diff --git a/src/app/shared/object-list/item-list-element/entity-list-element.component.html b/src/app/shared/object-list/item-list-element/entity-list-element.component.html new file mode 100644 index 0000000000..777f131a23 --- /dev/null +++ b/src/app/shared/object-list/item-list-element/entity-list-element.component.html @@ -0,0 +1 @@ + diff --git a/src/app/shared/object-list/item-list-element/entity-list-element.component.scss b/src/app/shared/object-list/item-list-element/entity-list-element.component.scss new file mode 100644 index 0000000000..45a533cd01 --- /dev/null +++ b/src/app/shared/object-list/item-list-element/entity-list-element.component.scss @@ -0,0 +1 @@ +@import '../../../../styles/variables'; diff --git a/src/app/shared/object-list/item-list-element/item-list-element.component.spec.ts b/src/app/shared/object-list/item-list-element/entity-list-element.component.spec.ts similarity index 87% rename from src/app/shared/object-list/item-list-element/item-list-element.component.spec.ts rename to src/app/shared/object-list/item-list-element/entity-list-element.component.spec.ts index fc40527693..8ff375c1ea 100644 --- a/src/app/shared/object-list/item-list-element/item-list-element.component.spec.ts +++ b/src/app/shared/object-list/item-list-element/entity-list-element.component.spec.ts @@ -1,4 +1,4 @@ -import { ItemListElementComponent } from './item-list-element.component'; +import { EntityListElementComponent } from './entity-list-element.component'; import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core'; import { By } from '@angular/platform-browser'; @@ -6,8 +6,8 @@ import { TruncatePipe } from '../../utils/truncate.pipe'; import { Item } from '../../../core/shared/item.model'; import { Observable } from 'rxjs/Observable'; -let itemListElementComponent: ItemListElementComponent; -let fixture: ComponentFixture; +let itemListElementComponent: EntityListElementComponent; +let fixture: ComponentFixture; const mockItemWithAuthorAndDate: Item = Object.assign(new Item(), { bitstreams: Observable.of({}), @@ -38,22 +38,22 @@ const mockItemWithoutAuthorAndDate: Item = Object.assign(new Item(), { }] }); -describe('ItemListElementComponent', () => { +describe('EntityListElementComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ ItemListElementComponent , TruncatePipe], + declarations: [ EntityListElementComponent , TruncatePipe], providers: [ { provide: 'objectElementProvider', useValue: {mockItemWithAuthorAndDate}} ], schemas: [ NO_ERRORS_SCHEMA ] - }).overrideComponent(ItemListElementComponent, { + }).overrideComponent(EntityListElementComponent, { set: { changeDetection: ChangeDetectionStrategy.Default } }).compileComponents(); })); beforeEach(async(() => { - fixture = TestBed.createComponent(ItemListElementComponent); + fixture = TestBed.createComponent(EntityListElementComponent); itemListElementComponent = fixture.componentInstance; })); diff --git a/src/app/shared/object-list/item-list-element/item-list-element.component.ts b/src/app/shared/object-list/item-list-element/entity-list-element.component.ts similarity index 51% rename from src/app/shared/object-list/item-list-element/item-list-element.component.ts rename to src/app/shared/object-list/item-list-element/entity-list-element.component.ts index 8dd09f71b9..0a284708a9 100644 --- a/src/app/shared/object-list/item-list-element/item-list-element.component.ts +++ b/src/app/shared/object-list/item-list-element/entity-list-element.component.ts @@ -1,15 +1,18 @@ -import { Component, Input, Inject } from '@angular/core'; +import { Component } from '@angular/core'; import { Item } from '../../../core/shared/item.model'; -import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component'; +import * as viewMode from '../../../shared/view-mode'; import { renderElementsFor } from '../../object-collection/shared/dso-element-decorator'; +import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component'; import { SetViewMode } from '../../view-mode'; @Component({ - selector: 'ds-item-list-element', - styleUrls: ['./item-list-element.component.scss'], - templateUrl: './item-list-element.component.html' + selector: 'ds-entity-list-element', + styleUrls: ['./entity-list-element.component.scss'], + templateUrl: './entity-list-element.component.html' }) @renderElementsFor(Item, SetViewMode.List) -export class ItemListElementComponent extends AbstractListableElementComponent {} +export class EntityListElementComponent extends AbstractListableElementComponent { + ElementViewMode = viewMode.ElementViewMode; +} diff --git a/src/app/shared/object-list/item-list-element/entity-types/entity-search-result-component.ts b/src/app/shared/object-list/item-list-element/entity-types/entity-search-result-component.ts new file mode 100644 index 0000000000..bcf2e45a8c --- /dev/null +++ b/src/app/shared/object-list/item-list-element/entity-types/entity-search-result-component.ts @@ -0,0 +1,74 @@ +import { Component, Inject } from '@angular/core'; +import { Observable } from 'rxjs/Observable'; +import { Item } from '../../../../core/shared/item.model'; +import { Metadatum } from '../../../../core/shared/metadatum.model'; +import { hasNoValue, hasValue, isEmpty } from '../../../empty.util'; +import { ITEM } from '../../../entities/switcher/entity-type-switcher.component'; +import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model'; +import { TruncatableService } from '../../../truncatable/truncatable.service'; + +// TODO lot of overlap with SearchResultListElementComponent => refactor! +@Component({ + selector: 'ds-entity-search-result', + template: '' +}) +export class EntitySearchResultComponent { + item: Item; + searchResult: ItemSearchResult; + + constructor( + private truncatableService: TruncatableService, + @Inject(ITEM) public object: Item | ItemSearchResult, + ) { + + if (hasValue((this.object as any).dspaceObject)) { + this.searchResult = this.object as ItemSearchResult; + this.item = this.searchResult.dspaceObject; + } else { + this.searchResult = { + dspaceObject: this.object as Item, + hitHighlights: [] + }; + this.item = this.object as Item; + } + } + + getValues(keys: string[]): string[] { + const results: string[] = new Array(); + this.searchResult.hitHighlights.forEach( + (md: Metadatum) => { + if (keys.indexOf(md.key) > -1) { + results.push(md.value); + } + } + ); + if (isEmpty(results)) { + this.item.filterMetadata(keys).forEach( + (md: Metadatum) => { + results.push(md.value); + } + ); + } + return results; + } + + getFirstValue(key: string): string { + let result: string; + this.searchResult.hitHighlights.some( + (md: Metadatum) => { + if (key === md.key) { + result = md.value; + return true; + } + } + ); + if (hasNoValue(result)) { + result = this.item.findMetadata(key); + } + return result; + } + + isCollapsed(): Observable { + return this.truncatableService.isCollapsed(this.item.id); + } +} diff --git a/src/app/shared/object-list/item-list-element/entity-types/item/item-list-element.component.html b/src/app/shared/object-list/item-list-element/entity-types/item/item-list-element.component.html new file mode 100644 index 0000000000..b5c125afaf --- /dev/null +++ b/src/app/shared/object-list/item-list-element/entity-types/item/item-list-element.component.html @@ -0,0 +1,24 @@ + + + + + (, ) + + + + + + + +
+ + +
+
diff --git a/src/app/shared/object-list/item-list-element/entity-types/item/item-list-element.component.scss b/src/app/shared/object-list/item-list-element/entity-types/item/item-list-element.component.scss new file mode 100644 index 0000000000..5ab410dcb0 --- /dev/null +++ b/src/app/shared/object-list/item-list-element/entity-types/item/item-list-element.component.scss @@ -0,0 +1 @@ +@import '../../../../../../styles/variables'; diff --git a/src/app/shared/object-list/item-list-element/entity-types/item/item-list-element.component.ts b/src/app/shared/object-list/item-list-element/entity-types/item/item-list-element.component.ts new file mode 100644 index 0000000000..db68ecec7b --- /dev/null +++ b/src/app/shared/object-list/item-list-element/entity-types/item/item-list-element.component.ts @@ -0,0 +1,15 @@ +import { Component } from '@angular/core'; +import { DEFAULT_ENTITY_TYPE, rendersEntityType } from '../../../../entities/entity-type-decorator'; +import { ElementViewMode } from '../../../../view-mode'; +import { EntitySearchResultComponent } from '../entity-search-result-component'; + +@rendersEntityType('Item', ElementViewMode.SetElement) +@rendersEntityType(DEFAULT_ENTITY_TYPE, ElementViewMode.SetElement) +@Component({ + selector: 'ds-item-list-element', + styleUrls: ['./item-list-element.component.scss'], + templateUrl: './item-list-element.component.html' +}) + +export class ItemListElementComponent extends EntitySearchResultComponent { +} diff --git a/src/app/shared/object-list/item-list-element/entity-types/orgunit/orgunit-list-element.component.html b/src/app/shared/object-list/item-list-element/entity-types/orgunit/orgunit-list-element.component.html new file mode 100644 index 0000000000..901d521033 --- /dev/null +++ b/src/app/shared/object-list/item-list-element/entity-types/orgunit/orgunit-list-element.component.html @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/src/app/shared/object-list/item-list-element/entity-types/orgunit/orgunit-list-element.component.scss b/src/app/shared/object-list/item-list-element/entity-types/orgunit/orgunit-list-element.component.scss new file mode 100644 index 0000000000..5ab410dcb0 --- /dev/null +++ b/src/app/shared/object-list/item-list-element/entity-types/orgunit/orgunit-list-element.component.scss @@ -0,0 +1 @@ +@import '../../../../../../styles/variables'; diff --git a/src/app/shared/object-list/item-list-element/entity-types/orgunit/orgunit-list-element.component.ts b/src/app/shared/object-list/item-list-element/entity-types/orgunit/orgunit-list-element.component.ts new file mode 100644 index 0000000000..9ae7489e97 --- /dev/null +++ b/src/app/shared/object-list/item-list-element/entity-types/orgunit/orgunit-list-element.component.ts @@ -0,0 +1,14 @@ +import { Component } from '@angular/core'; +import { rendersEntityType } from '../../../../entities/entity-type-decorator'; +import { ElementViewMode } from '../../../../view-mode'; +import { EntitySearchResultComponent } from '../entity-search-result-component'; + +@rendersEntityType('OrgUnit', ElementViewMode.SetElement) +@Component({ + selector: 'ds-orgunit-list-element', + styleUrls: ['./orgunit-list-element.component.scss'], + templateUrl: './orgunit-list-element.component.html' +}) + +export class OrgUnitListElementComponent extends EntitySearchResultComponent { +} diff --git a/src/app/shared/object-list/item-list-element/entity-types/person/person-list-element.component.html b/src/app/shared/object-list/item-list-element/entity-types/person/person-list-element.component.html new file mode 100644 index 0000000000..81e9300bb3 --- /dev/null +++ b/src/app/shared/object-list/item-list-element/entity-types/person/person-list-element.component.html @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff --git a/src/app/shared/object-list/item-list-element/entity-types/person/person-list-element.component.scss b/src/app/shared/object-list/item-list-element/entity-types/person/person-list-element.component.scss new file mode 100644 index 0000000000..5ab410dcb0 --- /dev/null +++ b/src/app/shared/object-list/item-list-element/entity-types/person/person-list-element.component.scss @@ -0,0 +1 @@ +@import '../../../../../../styles/variables'; diff --git a/src/app/shared/object-list/item-list-element/entity-types/person/person-list-element.component.ts b/src/app/shared/object-list/item-list-element/entity-types/person/person-list-element.component.ts new file mode 100644 index 0000000000..b1156b1372 --- /dev/null +++ b/src/app/shared/object-list/item-list-element/entity-types/person/person-list-element.component.ts @@ -0,0 +1,14 @@ +import { Component } from '@angular/core'; +import { rendersEntityType } from '../../../../entities/entity-type-decorator'; +import { ElementViewMode } from '../../../../view-mode'; +import { EntitySearchResultComponent } from '../entity-search-result-component'; + +@rendersEntityType('Person', ElementViewMode.SetElement) +@Component({ + selector: 'ds-person-list-element', + styleUrls: ['./person-list-element.component.scss'], + templateUrl: './person-list-element.component.html' +}) + +export class PersonListElementComponent extends EntitySearchResultComponent { +} diff --git a/src/app/shared/object-list/item-list-element/entity-types/project/project-list-element.component.html b/src/app/shared/object-list/item-list-element/entity-types/project/project-list-element.component.html new file mode 100644 index 0000000000..7eafd91317 --- /dev/null +++ b/src/app/shared/object-list/item-list-element/entity-types/project/project-list-element.component.html @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff --git a/src/app/shared/object-list/item-list-element/entity-types/project/project-list-element.component.scss b/src/app/shared/object-list/item-list-element/entity-types/project/project-list-element.component.scss new file mode 100644 index 0000000000..5ab410dcb0 --- /dev/null +++ b/src/app/shared/object-list/item-list-element/entity-types/project/project-list-element.component.scss @@ -0,0 +1 @@ +@import '../../../../../../styles/variables'; diff --git a/src/app/shared/object-list/item-list-element/entity-types/project/project-list-element.component.ts b/src/app/shared/object-list/item-list-element/entity-types/project/project-list-element.component.ts new file mode 100644 index 0000000000..f5275c47e8 --- /dev/null +++ b/src/app/shared/object-list/item-list-element/entity-types/project/project-list-element.component.ts @@ -0,0 +1,14 @@ +import { Component } from '@angular/core'; +import { rendersEntityType } from '../../../../entities/entity-type-decorator'; +import { ElementViewMode } from '../../../../view-mode'; +import { EntitySearchResultComponent } from '../entity-search-result-component'; + +@rendersEntityType('Project', ElementViewMode.SetElement) +@Component({ + selector: 'ds-project-list-element', + styleUrls: ['./project-list-element.component.scss'], + templateUrl: './project-list-element.component.html' +}) + +export class ProjectListElementComponent extends EntitySearchResultComponent { +} diff --git a/src/app/shared/object-list/item-list-element/item-list-element.component.html b/src/app/shared/object-list/item-list-element/item-list-element.component.html deleted file mode 100644 index b4259c25c2..0000000000 --- a/src/app/shared/object-list/item-list-element/item-list-element.component.html +++ /dev/null @@ -1,18 +0,0 @@ - - {{object.findMetadata("dc.title")}} - -
- - - {{authorMd.value}} - ; - - - ({{object.findMetadata("dc.publisher")}}, {{object.findMetadata("dc.date.issued")}}) - -
- {{object.findMetadata("dc.description.abstract") | dsTruncate:[200] }} -
-
diff --git a/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.html b/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.html index b8f3197a7c..777f131a23 100644 --- a/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.html +++ b/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.html @@ -1,24 +1 @@ - - - - - (, ) - - - - - - - -
- - -
-
\ No newline at end of file + diff --git a/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.ts b/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.ts index 37dcb907ef..b9ac52ca40 100644 --- a/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.ts +++ b/src/app/shared/object-list/search-result-list-element/item-search-result/item-search-result-list-element.component.ts @@ -1,12 +1,12 @@ -import { ChangeDetectorRef, Component, Inject, OnInit } from '@angular/core'; +import { Component } from '@angular/core'; +import { Item } from '../../../../core/shared/item.model'; +import { focusBackground } from '../../../animations/focus'; import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator'; -import { SearchResultListElementComponent } from '../search-result-list-element.component'; -import { Item } from '../../../../core/shared/item.model'; import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model'; +import * as viewMode from '../../../../shared/view-mode'; import { SetViewMode } from '../../../view-mode'; -import { ListableObject } from '../../../object-collection/shared/listable-object.model'; -import { focusBackground } from '../../../animations/focus'; +import { SearchResultListElementComponent } from '../search-result-list-element.component'; @Component({ selector: 'ds-item-search-result-list-element', @@ -18,4 +18,5 @@ import { focusBackground } from '../../../animations/focus'; @renderElementsFor(ItemSearchResult, SetViewMode.List) export class ItemSearchResultListElementComponent extends SearchResultListElementComponent { + ElementViewMode = viewMode.ElementViewMode; } diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index 79ddd8680f..90d498eedd 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -8,6 +8,12 @@ import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; import { TranslateModule } from '@ngx-translate/core'; import { NgxPaginationModule } from 'ngx-pagination'; +import { EntityTypeSwitcherComponent } from './entities/switcher/entity-type-switcher.component'; +import { EntitySearchResultComponent } from './object-list/item-list-element/entity-types/entity-search-result-component'; +import { ItemListElementComponent } from './object-list/item-list-element/entity-types/item/item-list-element.component'; +import { OrgUnitListElementComponent } from './object-list/item-list-element/entity-types/orgunit/orgunit-list-element.component'; +import { PersonListElementComponent } from './object-list/item-list-element/entity-types/person/person-list-element.component'; +import { ProjectListElementComponent } from './object-list/item-list-element/entity-types/project/project-list-element.component'; import { EnumKeysPipe } from './utils/enum-keys-pipe'; import { FileSizePipe } from './utils/file-size-pipe'; @@ -15,7 +21,7 @@ import { SafeUrlPipe } from './utils/safe-url-pipe'; import { CollectionListElementComponent } from './object-list/collection-list-element/collection-list-element.component'; import { CommunityListElementComponent } from './object-list/community-list-element/community-list-element.component'; -import { ItemListElementComponent } from './object-list/item-list-element/item-list-element.component'; +import { EntityListElementComponent } from './object-list/item-list-element/entity-list-element.component'; import { SearchResultListElementComponent } from './object-list/search-result-list-element/search-result-list-element.component'; import { WrapperListElementComponent } from './object-list/wrapper-list-element/wrapper-list-element.component'; import { ObjectListComponent } from './object-list/object-list.component'; @@ -89,11 +95,13 @@ const COMPONENTS = [ ViewModeSwitchComponent, TruncatableComponent, TruncatablePartComponent, + EntitySearchResultComponent, + EntityTypeSwitcherComponent ]; const ENTRY_COMPONENTS = [ // put shared entry components (components that are created dynamically) here - ItemListElementComponent, + EntityListElementComponent, CollectionListElementComponent, CommunityListElementComponent, SearchResultListElementComponent, @@ -101,6 +109,10 @@ const ENTRY_COMPONENTS = [ CollectionGridElementComponent, CommunityGridElementComponent, SearchResultGridElementComponent, + ItemListElementComponent, + PersonListElementComponent, + OrgUnitListElementComponent, + ProjectListElementComponent ]; const PROVIDERS = [ diff --git a/src/app/shared/view-mode.ts b/src/app/shared/view-mode.ts index c12d051943..e78da4fa83 100644 --- a/src/app/shared/view-mode.ts +++ b/src/app/shared/view-mode.ts @@ -5,7 +5,7 @@ export enum SetViewMode { export enum ElementViewMode { Full, - setElement + SetElement } export type ViewMode = SetViewMode | ElementViewMode;