From 86901fae2eec7f63df4aa88effa43535e9af4654 Mon Sep 17 00:00:00 2001 From: Lotte Hofstede Date: Thu, 4 May 2017 13:44:03 +0200 Subject: [PATCH] 40416: Start of file section --- src/app/core/shared/item.model.ts | 10 ++++++++ .../file-section/file-section.component.html | 4 ++++ .../file-section/file-section.component.ts | 24 +++++++++++++++++++ src/app/item-page/item-page-routing.module.ts | 2 +- src/app/item-page/item-page.component.html | 1 + src/server.routes.ts | 2 +- 6 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 src/app/item-page/file-section/file-section.component.html create mode 100644 src/app/item-page/file-section/file-section.component.ts diff --git a/src/app/core/shared/item.model.ts b/src/app/core/shared/item.model.ts index 3a021d4acb..4974abe1f2 100644 --- a/src/app/core/shared/item.model.ts +++ b/src/app/core/shared/item.model.ts @@ -50,6 +50,16 @@ export class Item extends DSpaceObject { ); } + getFiles(): Array> { + return this.getBundle("ORIGINAL").map(bundle => bundle.bitstreams.map(bitstream => bitstream.payload.flatMap(b => b))).; + // const bundle: Observable = this.getBundle("ORIGINAL"); + // return bundle.map( + // bundle => bundle.bitstreams.flatMap( + // bitstream => bitstream.payload + // ) + // ); + } + getBundle(name: String): Observable { return Observable.combineLatest( ...this.bundles.map(b => b.payload), diff --git a/src/app/item-page/file-section/file-section.component.html b/src/app/item-page/file-section/file-section.component.html new file mode 100644 index 0000000000..68c1bb36a5 --- /dev/null +++ b/src/app/item-page/file-section/file-section.component.html @@ -0,0 +1,4 @@ +
+ +
+ diff --git a/src/app/item-page/file-section/file-section.component.ts b/src/app/item-page/file-section/file-section.component.ts new file mode 100644 index 0000000000..4d0a1b5f02 --- /dev/null +++ b/src/app/item-page/file-section/file-section.component.ts @@ -0,0 +1,24 @@ +import { Component, Input } from '@angular/core'; +import { Bitstream } from "../../core/shared/bitstream.model"; +import { Item } from "../../core/shared/item.model"; + +@Component({ + selector: 'ds-metadata-field-wrapper', + styleUrls: ['./metadata-field-wrapper.component.css'], + templateUrl: './metadata-field-wrapper.component.html' +}) +export class MetadataFieldWrapperComponent { + + @Input() item: Item; + files: Array; + + constructor() { + this.universalInit(); + + } + + universalInit() { + this.files = this.item.getBundle("ORIGINAL").map(bundle => bundle.bitstreams.map(bitstream => bitstream.payload)); + } + +} diff --git a/src/app/item-page/item-page-routing.module.ts b/src/app/item-page/item-page-routing.module.ts index b8f2d1939f..64c0a607c5 100644 --- a/src/app/item-page/item-page-routing.module.ts +++ b/src/app/item-page/item-page-routing.module.ts @@ -6,7 +6,7 @@ import { ItemPageComponent } from './item-page.component'; @NgModule({ imports: [ RouterModule.forChild([ - { path: 'item/:id', pathMatch: 'full', component: ItemPageComponent }, + { path: 'items/:id', pathMatch: 'full', component: ItemPageComponent }, ]) ] }) diff --git a/src/app/item-page/item-page.component.html b/src/app/item-page/item-page.component.html index f6022ec103..59c963dd81 100644 --- a/src/app/item-page/item-page.component.html +++ b/src/app/item-page/item-page.component.html @@ -6,4 +6,5 @@ + diff --git a/src/server.routes.ts b/src/server.routes.ts index a7eea48344..704ea15df5 100644 --- a/src/server.routes.ts +++ b/src/server.routes.ts @@ -10,5 +10,5 @@ * ]; **/ export const routes: string[] = [ - 'home', 'item/:id' , '**' + 'home', 'items/:id' , '**' ];