Merge branch 'master' into live-rest-backend

This commit is contained in:
Art Lowel
2017-06-08 16:16:50 +02:00
parent 0677bc38ee
commit 9e1f7848b6
33 changed files with 258 additions and 6 deletions

View File

@@ -18,14 +18,16 @@ cache:
directories: directories:
- node_modules - node_modules
bundler_args: --retry 5
before_install: before_install:
- yarn run global - travis_retry yarn run global
install: install:
- yarn install - travis_retry yarn install
before_script: before_script:
- yarn run build - travis_wait yarn run build
- export CHROME_BIN=chromium-browser - export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0 - export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start - sh -e /etc/init.d/xvfb start

View File

@@ -4,6 +4,12 @@
"link.dspace": "DSpace software", "link.dspace": "DSpace software",
"link.duraspace": "DuraSpace" "link.duraspace": "DuraSpace"
}, },
"collection": {
"page": {
"news": "News",
"license": "License"
}
},
"item": { "item": {
"page": { "page": {
"author": "Author", "author": "Author",

View File

@@ -9,6 +9,7 @@ import { SharedModule } from './shared/shared.module';
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { HeaderComponent } from './header/header.component'; import { HeaderComponent } from './header/header.component';
import { CollectionPageModule } from './collection-page/collection-page.module';
import { PageNotFoundComponent } from './pagenotfound/pagenotfound.component'; import { PageNotFoundComponent } from './pagenotfound/pagenotfound.component';
@@ -22,6 +23,7 @@ import { PageNotFoundComponent } from './pagenotfound/pagenotfound.component';
SharedModule, SharedModule,
HomeModule, HomeModule,
ItemPageModule, ItemPageModule,
CollectionPageModule,
CoreModule.forRoot(), CoreModule.forRoot(),
AppRoutingModule AppRoutingModule
], ],

View File

@@ -0,0 +1,13 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { CollectionPageComponent } from './collection-page.component';
@NgModule({
imports: [
RouterModule.forChild([
{ path: 'collections/:id', component: CollectionPageComponent }
])
]
})
export class CollectionPageRoutingModule { }

View File

@@ -0,0 +1,16 @@
<div class="collection-page" *ngIf="collectionData.hasSucceeded | async">
<ds-collection-page-name [name]="(collectionData.payload | async)?.name"></ds-collection-page-name>
<ds-collection-page-logo *ngIf="logoData" [logo]="logoData.payload | async"></ds-collection-page-logo>
<ds-collection-page-introductory-text
[introductoryText]="(collectionData.payload | async)?.introductoryText">
</ds-collection-page-introductory-text>
<ds-collection-page-news
[sidebarText]="(collectionData.payload | async)?.sidebarText">
</ds-collection-page-news>
<ds-collection-page-copyright
[copyrightText]="(collectionData.payload | async)?.copyrightText">
</ds-collection-page-copyright>
<ds-collection-page-license
[license]="(collectionData.payload | async)?.license">
</ds-collection-page-license>
</div>

View File

@@ -0,0 +1 @@
@import '../../styles/variables.scss';

View File

@@ -0,0 +1,35 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Params } from '@angular/router';
import { Collection } from "../core/shared/collection.model";
import { Bitstream } from "../core/shared/bitstream.model";
import { RemoteData } from "../core/data/remote-data";
import { CollectionDataService } from "../core/data/collection-data.service";
@Component({
selector: 'ds-collection-page',
styleUrls: ['./collection-page.component.css'],
templateUrl: './collection-page.component.html',
})
export class CollectionPageComponent implements OnInit {
collectionData: RemoteData<Collection>;
logoData: RemoteData<Bitstream>;
constructor(
private collectionDataService: CollectionDataService,
private route: ActivatedRoute
) {
this.universalInit();
}
ngOnInit(): void {
this.route.params.subscribe((params: Params) => {
this.collectionData = this.collectionDataService.findById(params['id'])
this.collectionData.payload
.subscribe(collection => this.logoData = collection.logo);
});
}
universalInit() {
}
}

View File

@@ -0,0 +1,33 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { TranslateModule } from "@ngx-translate/core";
import { CollectionPageComponent } from './collection-page.component';
import { FieldWrapperComponent } from './field-wrapper/field-wrapper.component';
import { CollectionPageNameComponent } from './name/collection-page-name.component';
import { CollectionPageLogoComponent } from './logo/collection-page-logo.component';
import { CollectionPageIntroductoryTextComponent } from './introductory-text/collection-page-introductory-text.component';
import { CollectionPageNewsComponent } from './news/collection-page-news.component';
import { CollectionPageCopyrightComponent } from './copyright/collection-page-copyright.component';
import { CollectionPageLicenseComponent } from './license/collection-page-license.component';
import { CollectionPageRoutingModule } from './collection-page-routing.module';
@NgModule({
imports: [
CollectionPageRoutingModule,
CommonModule,
TranslateModule,
],
declarations: [
CollectionPageComponent,
FieldWrapperComponent,
CollectionPageNameComponent,
CollectionPageLogoComponent,
CollectionPageIntroductoryTextComponent,
CollectionPageNewsComponent,
CollectionPageCopyrightComponent,
CollectionPageLicenseComponent,
]
})
export class CollectionPageModule { }

View File

@@ -0,0 +1,3 @@
<ds-field-wrapper *ngIf="copyrightText" class="collection-page-copyright">
<p [innerHtml]="copyrightText"></p>
</ds-field-wrapper>

View File

@@ -0,0 +1 @@
@import '../../../styles/variables.scss';

View File

@@ -0,0 +1,11 @@
import { Component, Input } from '@angular/core';
@Component({
selector: 'ds-collection-page-copyright',
styleUrls: ['./collection-page-copyright.component.css'],
templateUrl: './collection-page-copyright.component.html',
})
export class CollectionPageCopyrightComponent {
@Input() copyrightText: String;
}

View File

@@ -0,0 +1,3 @@
<div class="collection-page-field-wrapper">
<ng-content></ng-content>
</div>

View File

@@ -0,0 +1 @@
@import '../../../styles/variables.scss';

View File

@@ -0,0 +1,11 @@
import { Component, Input } from '@angular/core';
@Component({
selector: 'ds-field-wrapper',
styleUrls: ['./field-wrapper.component.css'],
templateUrl: './field-wrapper.component.html',
})
export class FieldWrapperComponent {
@Input() name: String;
}

View File

@@ -0,0 +1,3 @@
<ds-field-wrapper *ngIf="introductoryText" class="collection-page-introductory-text">
<p [innerHtml]="introductoryText"></p>
</ds-field-wrapper>

View File

@@ -0,0 +1 @@
@import '../../../styles/variables.scss';

View File

@@ -0,0 +1,11 @@
import { Component, Input } from '@angular/core';
@Component({
selector: 'ds-collection-page-introductory-text',
styleUrls: ['./collection-page-introductory-text.component.css'],
templateUrl: './collection-page-introductory-text.component.html',
})
export class CollectionPageIntroductoryTextComponent {
@Input() introductoryText: String;
}

View File

@@ -0,0 +1,4 @@
<ds-field-wrapper *ngIf="license" class="collection-page-license">
<h2>{{ 'collection.page.license' | translate }}</h2>
<p>{{ license }}</p>
</ds-field-wrapper>

View File

@@ -0,0 +1 @@
@import '../../../styles/variables.scss';

View File

@@ -0,0 +1,11 @@
import { Component, Input } from '@angular/core';
@Component({
selector: 'ds-collection-page-license',
styleUrls: ['./collection-page-license.component.css'],
templateUrl: './collection-page-license.component.html',
})
export class CollectionPageLicenseComponent {
@Input() license: String;
}

View File

@@ -0,0 +1,3 @@
<ds-field-wrapper *ngIf="logo" class="collection-page-logo">
<img [src]="logo.url" class="img-responsive" alt="Collection logo" />
</ds-field-wrapper>

View File

@@ -0,0 +1 @@
@import '../../../styles/variables.scss';

View File

@@ -0,0 +1,13 @@
import { Component, Input } from '@angular/core';
import { Bitstream } from "../../core/shared/bitstream.model";
@Component({
selector: 'ds-collection-page-logo',
styleUrls: ['./collection-page-logo.component.css'],
templateUrl: './collection-page-logo.component.html',
})
export class CollectionPageLogoComponent {
@Input() logo: Bitstream;
}

View File

@@ -0,0 +1 @@
<h1 *ngIf="name">{{ name }}</h1>

View File

@@ -0,0 +1 @@
@import '../../../styles/variables.scss';

View File

@@ -0,0 +1,11 @@
import { Component, Input } from '@angular/core';
@Component({
selector: 'ds-collection-page-name',
styleUrls: ['./collection-page-name.component.css'],
templateUrl: './collection-page-name.component.html',
})
export class CollectionPageNameComponent {
@Input() name: String;
}

View File

@@ -0,0 +1,4 @@
<ds-field-wrapper *ngIf="sidebarText" class="collection-page-news">
<h2>{{ 'collection.page.news' | translate }}</h2>
<p [innerHtml]="sidebarText"></p>
</ds-field-wrapper>

View File

@@ -0,0 +1 @@
@import '../../../styles/variables.scss';

View File

@@ -0,0 +1,11 @@
import { Component, Input } from '@angular/core';
@Component({
selector: 'ds-collection-page-news',
styleUrls: ['./collection-page-news.component.css'],
templateUrl: './collection-page-news.component.html',
})
export class CollectionPageNewsComponent {
@Input() sidebarText: String;
}

View File

@@ -17,6 +17,8 @@ export class NormalizedCollection extends NormalizedDSpaceObject {
/** /**
* The Bitstream that represents the logo of this Collection * The Bitstream that represents the logo of this Collection
*/ */
@autoserialize
@relationship(ResourceType.Bitstream)
logo: string; logo: string;
/** /**

View File

@@ -43,6 +43,40 @@ export const BITSTREAMS = {
], ],
"format": "JPEG", "format": "JPEG",
"mimetype": "image/jpeg" "mimetype": "image/jpeg"
} },
{
"_links": {
"self": { "href": "/bitstreams/8934" },
"bundle": { "href": "/bundles/99f78e5e-3677-43b0-aaef-cddaa1a49092" },
"retrieve": { "href": "/rest/bitstreams/ba7d24f2-8fc7-4b8e-b7b6-6c32be1c12a6/retrieve" }
},
"id": "8934",
"uuid": "ba7d24f2-8fc7-4b8e-b7b6-6c32be1c12a6",
"name": "license.txt",
"size": 41183,
"checksum": {
"value": "8ad416e8a39e645020e13e06f1427814",
"algorithm": "MD5"
},
"metadata": [
{ "key": "dc.title", "value": "license.txt", "language": null },
{ "key": "dc.description", "value": "License", "language": "en" }
],
"format": "Text",
"mimetype": "text/plain"
},
{
"_links": {
"self": { "href": "/bitstreams/4688" },
},
"id": "4688",
"uuid": "1bb1be24-c934-41e3-a0fb-ca7a71ab0e71",
"type": "bitstream",
"name": "collection-5179-logo.png",
"size": 299832,
"url": "/bitstreams/1bb1be24-c934-41e3-a0fb-ca7a71ab0e71/retrieve",
"format": "PNG",
"mimetype": "image/png"
},
] ]
}; };

View File

@@ -6,7 +6,8 @@ export const COLLECTIONS = {
"items": [ "items": [
{ "href": "/items/8871" }, { "href": "/items/8871" },
{ "href": "/items/9978" } { "href": "/items/9978" }
] ],
"logo": { "href": "/bitstreams/4688" }
}, },
"id": "5179", "id": "5179",
"uuid": "9e32a2e2-6b91-4236-a361-995ccdc14c60", "uuid": "9e32a2e2-6b91-4236-a361-995ccdc14c60",

View File

@@ -10,5 +10,5 @@
* ]; * ];
**/ **/
export const routes: string[] = [ export const routes: string[] = [
'home', 'items/:id' , '**' 'home', 'items/:id' , 'collections/:id', '**'
]; ];