diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 3ec632b..07ce259 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -17,7 +17,6 @@ import {Composer} from "./openaireLibrary/utils/email/composer"; import {NotificationHandler} from "./openaireLibrary/utils/notification-handler"; import {EmailService} from "./openaireLibrary/utils/email/email.service"; import {StringUtils} from "./openaireLibrary/utils/string-utils.class"; -import {HelperFunctions} from "./openaireLibrary/utils/HelperFunctions.class"; import {QuickContactComponent} from "./openaireLibrary/sharedComponents/quick-contact/quick-contact.component"; import {AlertModal} from "./openaireLibrary/utils/modal/alert"; @@ -124,7 +123,8 @@ export class AppComponent { logoUrl: this.logoPath + 'logo-large-monitor.png', logoSmallUrl:this.logoPath + 'logo-small-monitor.png', position:'left', - badge:true + badge:true, + menuPosition: 'center' }; this.buildMenu(); this.reset(); @@ -152,7 +152,7 @@ export class AppComponent { items: [] }); this.menuItems.push({ - rootItem: new MenuItem("stakeholders", "Browse", "", "browse", false, [], null, {}), + rootItem: new MenuItem("stakeholders", "Browse", "", "/browse", false, [], null, {}), items: [] }); this.menuItems.push({ diff --git a/src/app/contact/contact.component.html b/src/app/contact/contact.component.html index 04f5e5d..6df9b54 100644 --- a/src/app/contact/contact.component.html +++ b/src/app/contact/contact.component.html @@ -1,5 +1,6 @@ -
+
@@ -7,19 +8,17 @@
-
- -

- Contact us. -

-
- We would be happy to open a discussion with you to better understand your needs and share examples of how - OpenAIRE MONITOR - can help your organization in your open science needs. -
-
-
+ +

+ Contact us. +

+
+ We would be happy to open a discussion with you to better understand your needs and share examples of how + OpenAIRE MONITOR + can help your organization in your open science needs. +
+
diff --git a/src/app/contact/contact.component.ts b/src/app/contact/contact.component.ts index 82d6f5e..d3a7dc9 100644 --- a/src/app/contact/contact.component.ts +++ b/src/app/contact/contact.component.ts @@ -1,15 +1,13 @@ import {Component, OnInit, ViewChild} from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router'; import {EmailService} from "../openaireLibrary/utils/email/email.service"; -import {Email} from "../openaireLibrary/utils/email/email"; import {EnvProperties} from "../openaireLibrary/utils/properties/env-properties"; import {Composer} from "../openaireLibrary/utils/email/composer"; import {Meta, Title} from "@angular/platform-browser"; import {PiwikService} from "../openaireLibrary/utils/piwik/piwik.service"; -import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class"; import {HelperService} from "../openaireLibrary/utils/helper/helper.service"; import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service"; -import {AbstractControl, FormBuilder, FormGroup, ValidatorFn, Validators} from "@angular/forms"; +import {FormBuilder, FormGroup, Validators} from "@angular/forms"; import {Subscriber} from "rxjs"; import {properties} from "../../environments/environment"; import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component"; @@ -26,9 +24,8 @@ export class ContactComponent implements OnInit { public pageTitle: string = "OpenAIRE - Monitor | Contact Us"; public description: string = "OpenAIRE - Monitor . Any Questions? Contact us to learn more"; public piwiksub: any; - public sending = true; - public email: Email; - public properties: EnvProperties = null; + public sending = false; + public properties: EnvProperties = properties; public pageContents = null; public divContents = null; public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'Contact us'}]; @@ -39,7 +36,8 @@ export class ContactComponent implements OnInit { ]; public contactForm: FormGroup; @ViewChild('modal') modal; - + private subscriptions = []; + constructor(private route: ActivatedRoute, private _router: Router, private emailService: EmailService, @@ -50,7 +48,7 @@ export class ContactComponent implements OnInit { private fb: FormBuilder, private helper: HelperService) { } - subscriptions = []; + ngOnDestroy() { this.subscriptions.forEach(subscription => { if (subscription instanceof Subscriber) { @@ -58,9 +56,8 @@ export class ContactComponent implements OnInit { } }); } + ngOnInit() { - this.properties = properties; - this.email = {body: '', subject: '', recipients: []}; if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, this.properties.piwikSiteId).subscribe()); } @@ -72,8 +69,6 @@ export class ContactComponent implements OnInit { this.reset(); //this.getDivContents(); // this.getPageContents(); - this.sending = false; - } private getPageContents() { @@ -89,7 +84,6 @@ export class ContactComponent implements OnInit { } public send(event) { - HelperFunctions.scroll(); if(event.valid === true) { this.sendMail(this.properties.admins); } diff --git a/src/app/get-started/get-started.component.html b/src/app/get-started/get-started.component.html index 8e3fb45..28e59d2 100644 --- a/src/app/get-started/get-started.component.html +++ b/src/app/get-started/get-started.component.html @@ -1,6 +1,6 @@ -
-
+
+
@@ -14,7 +14,7 @@
-
+
@@ -46,15 +46,19 @@

Provide some information.

-
- TODO: Contact form + SEND button +
+
+ + +
-
-
-

We need a title that
suggest to learn the full
process in the about.

+
+
+

We need a title that suggest to learn the full process in the about.

@@ -62,8 +66,14 @@
-
+
-
\ No newline at end of file +
+ +
+ Our team will respond to your submission soon.
+ Press OK to redirect to OpenAIRE Monitor home page. +
+
diff --git a/src/app/get-started/get-started.component.ts b/src/app/get-started/get-started.component.ts index 51b46a7..ec56632 100644 --- a/src/app/get-started/get-started.component.ts +++ b/src/app/get-started/get-started.component.ts @@ -13,166 +13,152 @@ import {AbstractControl, FormBuilder, FormGroup, ValidatorFn, Validators} from " import {Subscriber} from "rxjs"; import {properties} from "../../environments/environment"; import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component"; +import {NotificationHandler} from "../openaireLibrary/utils/notification-handler"; +import {StringUtils} from "../openaireLibrary/utils/string-utils.class"; @Component({ - selector: 'get-started', - templateUrl: './get-started.component.html', + selector: 'get-started', + templateUrl: './get-started.component.html', }) export class GetStartedComponent implements OnInit { - public url: string = null; - public pageTitle: string = "OpenAIRE - Monitor | Get Started"; - public description: string = "OpenAIRE - Monitor . Any Questions? Contact us to learn more"; - public piwiksub: any; - public showLoading = true; - public errorMessage = ''; - public email: Email; - public properties: EnvProperties = null; - public pageContents = null; - public divContents = null; - public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'Get started'}]; - public organizationTypes: string[] = [ - 'Funding agency', 'University / Research Center', - 'Research Infrastructure', 'Government', - 'Non-profit', 'Industry', 'Other' - ]; - public contactForm: FormGroup; - @ViewChild('AlertModal') modal; - - constructor(private route: ActivatedRoute, - private _router: Router, - private _emailService: EmailService, - private _meta: Meta, - private _title: Title, - private seoService: SEOService, - private _piwikService: PiwikService, - private fb: FormBuilder, - private helper: HelperService) { + public url: string = null; + public pageTitle: string = "OpenAIRE - Monitor | Get Started"; + public description: string = "OpenAIRE - Monitor . Any Questions? Contact us to learn more"; + public piwiksub: any; + public sending = false; + public properties: EnvProperties = properties; + public pageContents = null; + public divContents = null; + public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'Get started'}]; + public organizationTypes: string[] = [ + 'Funding agency', 'University / Research Center', + 'Research Infrastructure', 'Government', + 'Non-profit', 'Industry', 'Other' + ]; + public contactForm: FormGroup; + @ViewChild('modal') modal; + private subscriptions = []; + + constructor(private route: ActivatedRoute, + private _router: Router, + private _emailService: EmailService, + private _meta: Meta, + private _title: Title, + private seoService: SEOService, + private _piwikService: PiwikService, + private fb: FormBuilder, + private helper: HelperService) { + } + + ngOnDestroy() { + this.subscriptions.forEach(subscription => { + if (subscription instanceof Subscriber) { + subscription.unsubscribe(); + } + }); + } + + ngOnInit() { + if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { + this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, this.properties.piwikSiteId).subscribe()); } - subscriptions = []; - ngOnDestroy() { - this.subscriptions.forEach(subscription => { - if (subscription instanceof Subscriber) { - subscription.unsubscribe(); - } - }); + this.url = this.properties.domain + this.properties.baseLink + this._router.url; + this.seoService.createLinkForCanonicalURL(this.url); + this.updateUrl(this.url); + this.updateTitle(this.pageTitle); + this.updateDescription(this.description); + this.reset(); + //this.getDivContents(); + // this.getPageContents(); + } + + private getPageContents() { + this.subscriptions.push(this.helper.getPageHelpContents(this.properties, 'monitor', this._router.url).subscribe(contents => { + this.pageContents = contents; + })); + } + + private getDivContents() { + this.subscriptions.push(this.helper.getDivHelpContents(this.properties, 'monitor', this._router.url).subscribe(contents => { + this.divContents = contents; + })); + } + + public send(event) { + if (event.valid === true) { + this.sendMail(this.properties.admins); } - ngOnInit() { - this.properties = properties; - this.email = {body: '', subject: '', recipients: []}; - if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { - this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, this.properties.piwikSiteId).subscribe()); - } - this.url = this.properties.domain + this.properties.baseLink + this._router.url; - this.seoService.createLinkForCanonicalURL(this.url); - this.updateUrl(this.url); - this.updateTitle(this.pageTitle); - this.updateDescription(this.description); - this.reset(); - //this.getDivContents(); - // this.getPageContents(); - this.showLoading = false; - - } - - private getPageContents() { - this.subscriptions.push(this.helper.getPageHelpContents(this.properties, 'monitor', this._router.url).subscribe(contents => { - this.pageContents = contents; - })); - } - - private getDivContents() { - this.subscriptions.push(this.helper.getDivHelpContents(this.properties, 'monitor', this._router.url).subscribe(contents => { - this.divContents = contents; - })); - } - - public send(event) { - HelperFunctions.scroll(); - if(event.valid === true) { - this.sendMail(this.properties.admins); + } + + public reset() { + this.contactForm = this.fb.group({ + name: this.fb.control('', Validators.required), + surname: this.fb.control('', Validators.required), + email: this.fb.control('', [Validators.required, Validators.email]), + job: this.fb.control('', Validators.required), + organization: this.fb.control('', Validators.required), + organizationType: this.fb.control('', [Validators.required, StringUtils.validatorType(this.organizationTypes)]), + message: this.fb.control('', Validators.required), + recaptcha: this.fb.control('', Validators.required), + }); + } + + private sendMail(admins: any) { + this.sending = true; + this.subscriptions.push(this._emailService.contact(this.properties, + Composer.composeEmailForMonitor(this.contactForm.value, admins), + this.contactForm.value.recaptcha).subscribe( + res => { + if (res) { + this.sending = false; + this.reset(); + this.modalOpen(); } else { - this.errorMessage = 'Please fill in all the required fields!'; + this.handleError('Email sent failed! Please try again.'); } + }, + error => { + this.handleError('Email sent failed! Please try again.', error); + + } + )); + } + + public modalOpen() { + this.modal.okButton = true; + this.modal.alertTitle = 'Your request has been successfully submitted'; + this.modal.alertMessage = false; + this.modal.cancelButton = false; + this.modal.okButtonLeft = false; + this.modal.okButtonText = 'OK'; + this.modal.open(); + } + + handleError(message: string, error = null) { + if(error) { + console.error(error); } - - private validatorType(options: string[]): ValidatorFn { - return (control: AbstractControl): { [key: string]: boolean } | null => { - if (options.filter(type => type === control.value).length === 0) { - return {'type': false}; - } - return null; - } - } - - public reset() { - this.contactForm = this.fb.group( { - name: this.fb.control('', Validators.required), - surname: this.fb.control('', Validators.required), - email: this.fb.control('', [Validators.required, Validators.email]), - job: this.fb.control('', Validators.required), - organization: this.fb.control('', Validators.required), - organizationType: this.fb.control('', [Validators.required, this.validatorType(this.organizationTypes)]), - message: this.fb.control('', Validators.required), - recaptcha: this.fb.control('', Validators.required), - }); - this.errorMessage = ''; - } - - private sendMail(admins: any) { - this.showLoading = true; - this.subscriptions.push(this._emailService.contact(this.properties, - Composer.composeEmailForMonitor(this.contactForm.value, admins), - this.contactForm.value.recaptcha).subscribe( - res => { - this.showLoading = false; - if (res) { - this.reset(); - this.modalOpen(); - } else { - this.errorMessage = 'Email sent failed! Please try again.'; - this.contactForm.get('recaptcha').setValue(''); - } - }, - error => { - this.handleError('Email sent failed! Please try again.', error); - this.showLoading = false; - this.contactForm.get('recaptcha').setValue(''); - } - )); - } - - public modalOpen() { - this.modal.okButton = true; - this.modal.alertTitle = 'Your request has been successfully submitted'; - this.modal.alertMessage = false; - this.modal.cancelButton = false; - this.modal.okButtonLeft = false; - this.modal.okButtonText = 'OK'; - this.modal.open(); - } - - handleError(message: string, error) { - this.errorMessage = message; - console.log('Server responded: ' + error); - this.showLoading = false; - } - - public goToHome() { - this._router.navigate(['/']); - } - - private updateDescription(description: string) { - this._meta.updateTag({content: description}, "name='description'"); - this._meta.updateTag({content: description}, "property='og:description'"); - } - - private updateTitle(title: string) { - var _title = ((title.length > 50) ? title.substring(0, 50) : title); - this._title.setTitle(_title); - this._meta.updateTag({content: _title}, "property='og:title'"); - } - - private updateUrl(url: string) { - this._meta.updateTag({content: url}, "property='og:url'"); - } + NotificationHandler.rise(message, 'danger'); + this.sending = false; + this.contactForm.get('recaptcha').setValue(''); + } + + public goToHome() { + this._router.navigate(['/']); + } + + private updateDescription(description: string) { + this._meta.updateTag({content: description}, "name='description'"); + this._meta.updateTag({content: description}, "property='og:description'"); + } + + private updateTitle(title: string) { + var _title = ((title.length > 50) ? title.substring(0, 50) : title); + this._title.setTitle(_title); + this._meta.updateTag({content: _title}, "property='og:title'"); + } + + private updateUrl(url: string) { + this._meta.updateTag({content: url}, "property='og:url'"); + } } diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html index 04c8626..bfb59e2 100644 --- a/src/app/home/home.component.html +++ b/src/app/home/home.component.html @@ -2,15 +2,17 @@
-

- A new era of
monitoring
research. -

-
-
Work together with us to view, understand and visualize
-
research statistics and indicators.
-
-
- Get Started +
+

+ A new era of monitoring research. +

+
+
Work together with us to view, understand and visualize
+
research statistics and indicators.
+
+
diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index ada419f..d590732 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit ada419f8e82836c19633544aeddcc7ca31a5699b +Subproject commit d590732aba2a632036b006fb3de683cdb5df8ade