diff --git a/package.json b/package.json index 3585074..2d77678 100644 --- a/package.json +++ b/package.json @@ -27,22 +27,14 @@ "postinstall": "typings install" }, "dependencies": { - "angular2": "2.0.0-beta.15", - "angular2-express-engine": "0.10.0", - "angular2-hapi-engine": "0.10.1", - "angular2-universal": "0.94.2", - "angular2-universal-polyfills": "0.4.1", + "angular2": "2.0.0-beta.17", + "angular2-universal": "0.99.0", "bootstrap": "3.3.6", - "css": "2.2.1", - "es6-shim": "0.35.0", "express": "4.13.4", - "ng2-translate": "1.11.1", + "ng2-translate": "2.0.0", "object-hash": "1.1.2", - "parse5": "1.5.0", - "preboot": "2.0.7", - "reflect-metadata": "0.1.2", - "rxjs": "5.0.0-beta.2", - "zone.js": "0.6.12" + "preboot": "2.0.9", + "rxjs": "5.0.0-beta.6" }, "devDependencies": { "commander": "2.9.0", diff --git a/src/app/boot.ts b/src/app/boot.ts index 18d56b8..8b08a5d 100644 --- a/src/app/boot.ts +++ b/src/app/boot.ts @@ -1,29 +1,36 @@ import 'angular2-universal/polyfills'; -import {prebootComplete} from 'angular2-universal'; -import {bootstrap} from 'angular2/platform/browser'; -import {HTTP_PROVIDERS, Http} from 'angular2/http'; -import {ROUTER_PROVIDERS} from 'angular2/router'; -import {FORM_PROVIDERS} from 'angular2/common'; -import {enableProdMode, provide} from 'angular2/core'; +import { + bootstrap, + enableProdMode, + prebootComplete, + BROWSER_ROUTER_PROVIDERS, + BROWSER_HTTP_PROVIDERS} from 'angular2-universal'; + +import {Http} from 'angular2/http'; + +import {provide} from 'angular2/core'; import { TranslateLoader, - TranslateStaticLoader, TranslateService + TranslateStaticLoader, + TranslateService } from "ng2-translate/ng2-translate"; import {AppComponent} from './app.component'; -import {DSpaceService} from './dspace/services/dspace.service'; import {AuthorizationService} from './dspace/authorization/services/authorization.service'; import {BreadcrumbService} from './navigation/services/breadcrumb.service'; -import {PaginationService} from './navigation/services/pagination.service'; +import {ContextProviderService} from './dspace/services/context-provider.service'; +import {DSpaceConstants} from './dspace/dspace.constants'; +import {DSpaceDirectory} from './dspace/dspace.directory'; +import {DSpaceService} from './dspace/services/dspace.service'; +import {GoogleScholarMetadataService} from './utilities/services/google-scholar-metadata.service.ts'; import {HttpService} from './utilities/services/http.service'; +import {MetadataHelper} from './utilities/metadata.helper'; import {MetaTagService} from "./utilities/meta-tag/meta-tag.service"; -import {StorageService} from './utilities/services/storage.service'; +import {PaginationService} from './navigation/services/pagination.service'; import {PagingStoreService} from './dspace/services/paging-store.service'; -import {ContextProviderService} from './dspace/services/context-provider.service'; -import {DSpaceDirectory} from './dspace/dspace.directory'; -import {DSpaceConstants} from './dspace/dspace.constants'; +import {StorageService} from './utilities/services/storage.service'; // Disable Angular 2's "development mode". // See: https://angular.io/docs/ts/latest/api/core/enableProdMode-function.html @@ -39,24 +46,24 @@ enableProdMode(); * http://blog.thoughtram.io/angular/2015/05/18/dependency-injection-in-angular-2.html **/ bootstrap(AppComponent, [ - ROUTER_PROVIDERS, - HTTP_PROVIDERS, - FORM_PROVIDERS, + ...BROWSER_ROUTER_PROVIDERS, + ...BROWSER_HTTP_PROVIDERS, provide(TranslateLoader, { useFactory: (http: Http) => new TranslateStaticLoader(http, 'i18n', '.json'), deps: [Http] }), AuthorizationService, BreadcrumbService, + ContextProviderService, DSpaceConstants, DSpaceDirectory, DSpaceService, + GoogleScholarMetadataService, HttpService, - ContextProviderService, + MetadataHelper, MetaTagService, PaginationService, PagingStoreService, StorageService, TranslateService -]) -.then(prebootComplete); +]).then(prebootComplete); diff --git a/src/app/dspace/authorization/components/login-form.component.ts b/src/app/dspace/authorization/components/login-form.component.ts index 76e5411..2e4c1f4 100644 --- a/src/app/dspace/authorization/components/login-form.component.ts +++ b/src/app/dspace/authorization/components/login-form.component.ts @@ -14,7 +14,7 @@ import {FormModal, ModalAction} from '../../../utilities/components/form-modal.c directives: [FormModal], pipes: [TranslatePipe], template: ` - - { this.login.hide(); this.login.finished(); - this.unauthorized = false; + this.reset(); }, error => { this.unauthorized = true; @@ -152,6 +154,17 @@ export class LoginFormComponent { this.login.finished(); }); } + else if(action == ModalAction.CANCEL) { + this.reset(); + } + } + + reset(): void { + this.email = ''; + this.password = ''; + this.active = false; + this.unauthorized = false; + setTimeout(() => this.active = true, 0); } } \ No newline at end of file diff --git a/src/app/dspace/authorization/services/authorization.service.ts b/src/app/dspace/authorization/services/authorization.service.ts index 11a2f06..f4a4a4f 100644 --- a/src/app/dspace/authorization/services/authorization.service.ts +++ b/src/app/dspace/authorization/services/authorization.service.ts @@ -79,11 +79,8 @@ export class AuthorizationService { let statusResponse: Observable = this.dspace.status(token); statusResponse.subscribe(response => { - console.log(response); this.user = new User(response); - console.log(this.user); - //{ // this.storageService.store('email', email); // this.storageService.store('token', token); diff --git a/src/app/dspace/components/item-create.component.ts b/src/app/dspace/components/item-create.component.ts index 8cbf74d..5a25215 100644 --- a/src/app/dspace/components/item-create.component.ts +++ b/src/app/dspace/components/item-create.component.ts @@ -52,7 +52,7 @@ import {Metadatum} from '../models/metadatum.model'; - +
@@ -71,7 +71,7 @@ import {Metadatum} from '../models/metadatum.model'; diff --git a/src/app/dspace/components/item-list.component.ts b/src/app/dspace/components/item-list.component.ts index b2a3cf1..9c17584 100644 --- a/src/app/dspace/components/item-list.component.ts +++ b/src/app/dspace/components/item-list.component.ts @@ -20,7 +20,7 @@ import {PaginationComponent} from '../../navigation/components/pagination.compon inputs: ['items', 'collection'], template: ` -
+
diff --git a/src/app/dspace/components/item.component.ts b/src/app/dspace/components/item.component.ts index d8e90e0..2c58865 100644 --- a/src/app/dspace/components/item.component.ts +++ b/src/app/dspace/components/item.component.ts @@ -1,5 +1,5 @@ import {Component} from 'angular2/core'; -import {RouteConfig, RouterOutlet, RouteParams, CanDeactivate, ComponentInstruction, Location} from 'angular2/router'; +import {RouteConfig, RouterOutlet, RouteParams, CanDeactivate, ComponentInstruction} from 'angular2/router'; import {DSpaceDirectory} from '../dspace.directory'; import {BreadcrumbService} from '../../navigation/services/breadcrumb.service'; diff --git a/src/app/dspace/components/item/authors.component.ts b/src/app/dspace/components/item/authors.component.ts index fe0c925..97d0e01 100644 --- a/src/app/dspace/components/item/authors.component.ts +++ b/src/app/dspace/components/item/authors.component.ts @@ -15,12 +15,11 @@ import {ViewElementComponent} from './view-element.component'; directives: [ViewElementComponent], inputs: ['itemData'], pipes: [TranslatePipe], - providers: [MetadataHelper], template: ` -
+

{{ metadatum.value }}

diff --git a/src/app/dspace/components/item/bitstreams.component.ts b/src/app/dspace/components/item/bitstreams.component.ts index 709a6ef..5e46575 100644 --- a/src/app/dspace/components/item/bitstreams.component.ts +++ b/src/app/dspace/components/item/bitstreams.component.ts @@ -15,7 +15,7 @@ import {ViewElementComponent} from './view-element.component' pipes: [TranslatePipe], template: ` -
+
{{bitstream.name}} diff --git a/src/app/dspace/components/item/collection.component.ts b/src/app/dspace/components/item/collection.component.ts index 7bdecd6..911e543 100644 --- a/src/app/dspace/components/item/collection.component.ts +++ b/src/app/dspace/components/item/collection.component.ts @@ -14,7 +14,7 @@ import {ViewElementComponent} from './view-element.component'; directives: [ROUTER_DIRECTIVES, ViewElementComponent], pipes: [TranslatePipe], template: ` - + {{ itemParent.name }} ` diff --git a/src/app/dspace/components/item/date.component.ts b/src/app/dspace/components/item/date.component.ts index 13c389f..176e5ca 100644 --- a/src/app/dspace/components/item/date.component.ts +++ b/src/app/dspace/components/item/date.component.ts @@ -18,7 +18,7 @@ import {ViewElementComponent} from './view-element.component' pipes: [TruncateDatePipe, TranslatePipe], template: ` -
+

{{ metadatum.value | truncatedate}}

diff --git a/src/app/dspace/components/item/full/full-bitstreams.component.ts b/src/app/dspace/components/item/full/full-bitstreams.component.ts index 6abad56..70d3206 100644 --- a/src/app/dspace/components/item/full/full-bitstreams.component.ts +++ b/src/app/dspace/components/item/full/full-bitstreams.component.ts @@ -15,7 +15,7 @@ import {ViewElementComponent} from '../view-element.component'; template: `
-
+
diff --git a/src/app/dspace/components/item/full/full-metadata.component.ts b/src/app/dspace/components/item/full/full-metadata.component.ts index b8718fa..e1885dc 100644 --- a/src/app/dspace/components/item/full/full-metadata.component.ts +++ b/src/app/dspace/components/item/full/full-metadata.component.ts @@ -23,7 +23,7 @@ import {ViewElementComponent} from '../view-element.component'; - + {{ metadatum.key }} {{ metadatum.value }} {{ metadatum.language }} diff --git a/src/app/dspace/components/item/list/list-entry.component.ts b/src/app/dspace/components/item/list/list-entry.component.ts index b4b0f98..59bc78b 100644 --- a/src/app/dspace/components/item/list/list-entry.component.ts +++ b/src/app/dspace/components/item/list/list-entry.component.ts @@ -9,7 +9,8 @@ import {Item} from '../../../models/item.model'; @Component({ selector: 'list-entry', inputs: ['item'], - directives:[ListMetadataComponent, ThumbnailComponent], + directives:[ListMetadataComponent, + ThumbnailComponent], pipes: [TranslatePipe], template: ` diff --git a/src/app/dspace/components/item/list/list-metadata.component.ts b/src/app/dspace/components/item/list/list-metadata.component.ts index bbe8811..09da23c 100644 --- a/src/app/dspace/components/item/list/list-metadata.component.ts +++ b/src/app/dspace/components/item/list/list-metadata.component.ts @@ -18,33 +18,34 @@ import {ObjectUtil} from "../../../../utilities/commons/object.util"; selector: 'item-list-metadata', inputs: ['item'], directives: [ROUTER_DIRECTIVES], - pipes: [TranslatePipe, TruncatePipe, TruncateDatePipe], + pipes: [TranslatePipe, + TruncatePipe, + TruncateDatePipe], template: ` {{ item.name }}
{{author}} ({{date | truncatedate}})
-

{{abstract | truncate : 200}}

- ` }) -export class ListMetadataComponent -{ +export class ListMetadataComponent { - private item : Item; - private author : String; - private abstract : String; - private date : String; + private item: Item; - ngOnInit() { - let helper = new MetadataHelper(); - let filteredData:Metadatum[] = helper.filterMetadata(this.item.metadata, ["dc.contributor.author", "dc.creator", "dc.contributor", "dc.description.abstract","dc.date.accessioned"]); + private author: String; + + private abstract: String; - if (filteredData != null) - { + private date: String; + + constructor(private metadataHelper: MetadataHelper) {} + + ngOnInit() { + let filteredData: Array = this.metadataHelper.filterMetadata(this.item.metadata, ["dc.contributor.author", "dc.creator", "dc.contributor", "dc.description.abstract", "dc.date.accessioned"]); + if (filteredData != null) { for (let i:number = 0; i < filteredData.length; i++) { if (filteredData[i].element == "creator") { this.author = (filteredData[i].value); @@ -52,26 +53,22 @@ export class ListMetadataComponent if (filteredData[i].element == "description" && filteredData[i].value!="Not available") { this.abstract = filteredData[i].value; } - if(filteredData[i].element == "date") - { + if(filteredData[i].element == "date") { this.date = filteredData[i].value; } } } } - shouldRenderHeader() - { + shouldRenderHeader(): boolean { return ObjectUtil.hasValue(this.author) || this.shouldRenderDate(); } - shouldRenderDate() - { + shouldRenderDate(): boolean { return ObjectUtil.hasValue(this.date); } - shouldRenderAbstract() - { + shouldRenderAbstract(): boolean { return ObjectUtil.hasValue(this.abstract); } } diff --git a/src/app/dspace/components/item/metadata.component.ts b/src/app/dspace/components/item/metadata.component.ts index a6618d1..25e4763 100644 --- a/src/app/dspace/components/item/metadata.component.ts +++ b/src/app/dspace/components/item/metadata.component.ts @@ -14,11 +14,10 @@ import {ViewElementComponent} from './view-element.component'; selector: 'item-metadata', inputs: ['itemData'], directives: [ViewElementComponent], - providers: [MetadataHelper], pipes: [TranslatePipe], template: ` -
+
{{ metadatum.key }}

{{ metadatum.value }}

diff --git a/src/app/dspace/components/item/uri.component.ts b/src/app/dspace/components/item/uri.component.ts index bf5c09d..79181c6 100644 --- a/src/app/dspace/components/item/uri.component.ts +++ b/src/app/dspace/components/item/uri.component.ts @@ -13,11 +13,10 @@ import {ViewElementComponent} from './view-element.component'; selector: 'item-uri', inputs: ['itemData'], directives: [ViewElementComponent], - providers: [MetadataHelper], pipes: [TranslatePipe], template: ` -
+ diff --git a/src/app/dspace/services/dspace.service.ts b/src/app/dspace/services/dspace.service.ts index 9c671cb..9089fc6 100644 --- a/src/app/dspace/services/dspace.service.ts +++ b/src/app/dspace/services/dspace.service.ts @@ -29,9 +29,7 @@ export class DSpaceService { * @param httpService * HttpService is a singleton service to provide basic xhr requests. */ - constructor(private httpService: HttpService) { - - } + constructor(private httpService: HttpService) {} /** * Method to fetch top communities for navigation purposes. @@ -186,7 +184,6 @@ export class DSpaceService { * DSpace user token */ status(token): Observable { - console.log(token); return this.httpService.get({ url: URLHelper.relativeToAbsoluteRESTURL('/status'), headers: [{ diff --git a/src/app/navigation/components/breadcrumb.component.ts b/src/app/navigation/components/breadcrumb.component.ts index 3ea3b02..fb31590 100644 --- a/src/app/navigation/components/breadcrumb.component.ts +++ b/src/app/navigation/components/breadcrumb.component.ts @@ -13,7 +13,7 @@ import {BreadcrumbService} from '../services/breadcrumb.service'; directives: [ROUTER_DIRECTIVES], template: `