Merge branch 'new-theme' of code-repo.d4science.org:MaDgIK/connect into new-theme
# Conflicts: # src/app/openaireLibrary # src/assets/openaire-theme
This commit is contained in:
commit
e978b2967f
|
@ -7,21 +7,19 @@
|
||||||
<div class="uk-section uk-padding-remove-top uk-container uk-container-large">
|
<div class="uk-section uk-padding-remove-top uk-container uk-container-large">
|
||||||
<div class="uk-padding-small uk-width-1-2@l uk-width-2-3@m uk-width-1-1">
|
<div class="uk-padding-small uk-width-1-2@l uk-width-2-3@m uk-width-1-1">
|
||||||
<div class="uk-position-relative">
|
<div class="uk-position-relative">
|
||||||
<contact-us *ngIf="!showLoading"
|
<contact-us [sending]="sending" [contactForm]="contactForm" (sendEmitter)="send($event)">
|
||||||
[properties]="properties" [errorMessage]="errorMessage"
|
|
||||||
[contactForm]="contactForm" (sendEmitter)="send($event)">
|
|
||||||
<h1 page-title class="uk-margin-auto">
|
<h1 page-title class="uk-margin-auto">
|
||||||
Contact us to <br> learn more<span class="uk-text-primary">.</span>
|
Contact us to <br> learn more<span class="uk-text-primary">.</span>
|
||||||
</h1>
|
</h1>
|
||||||
</contact-us>
|
</contact-us>
|
||||||
<div *ngIf="showLoading" class="uk-position-center uk-margin-medium-top">
|
<div *ngIf="sending" class="uk-position-center uk-margin-medium-top">
|
||||||
<loading></loading>
|
<loading></loading>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<modal-alert #AlertModal (alertOutput)="goToHome()">
|
<modal-alert #AlertModal (alertOutput)="goToHome()">
|
||||||
<div class="uk-text-center">
|
<div class="uk-padding-small uk-padding-remove-horizontal">
|
||||||
Our team will respond to your submission soon.<br>
|
Our team will respond to your submission soon.<br>
|
||||||
Press OK to redirect to OpenAIRE Connect home page.
|
Press OK to redirect to OpenAIRE Connect home page.
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -13,6 +13,7 @@ import {FormBuilder, FormGroup, Validators} from "@angular/forms";
|
||||||
import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component";
|
import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component";
|
||||||
import {Subscriber} from "rxjs";
|
import {Subscriber} from "rxjs";
|
||||||
import {properties} from "../../environments/environment";
|
import {properties} from "../../environments/environment";
|
||||||
|
import {NotificationHandler} from "../openaireLibrary/utils/notification-handler";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'contact',
|
selector: 'contact',
|
||||||
|
@ -23,17 +24,16 @@ export class ContactComponent implements OnInit {
|
||||||
public url: string = null;
|
public url: string = null;
|
||||||
public pageTitle: string = "OpenAIRE - Connect | Contact Us";
|
public pageTitle: string = "OpenAIRE - Connect | Contact Us";
|
||||||
public description: string = "Contact us to learn more about OpenAIRE Connect Research Gateways";
|
public description: string = "Contact us to learn more about OpenAIRE Connect Research Gateways";
|
||||||
public showLoading = true;
|
public sending = true;
|
||||||
public errorMessage = '';
|
|
||||||
public email: Email;
|
public email: Email;
|
||||||
public properties: EnvProperties = null;
|
public properties: EnvProperties = properties;
|
||||||
public pageContents = null;
|
public pageContents = null;
|
||||||
public divContents = null;
|
public divContents = null;
|
||||||
public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'Contact us'}];
|
public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'Contact us'}];
|
||||||
|
|
||||||
public contactForm: FormGroup;
|
public contactForm: FormGroup;
|
||||||
@ViewChild('AlertModal') modal;
|
@ViewChild('AlertModal') modal;
|
||||||
private subscriptions = [];
|
private subscriptions = [];
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
this.subscriptions.forEach(subscription => {
|
this.subscriptions.forEach(subscription => {
|
||||||
if (subscription instanceof Subscriber) {
|
if (subscription instanceof Subscriber) {
|
||||||
|
@ -70,7 +70,7 @@ export class ContactComponent implements OnInit {
|
||||||
this.reset();
|
this.reset();
|
||||||
//this.getDivContents();
|
//this.getDivContents();
|
||||||
this.getPageContents();
|
this.getPageContents();
|
||||||
this.showLoading = false;
|
this.sending = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,8 +90,6 @@ export class ContactComponent implements OnInit {
|
||||||
HelperFunctions.scroll();
|
HelperFunctions.scroll();
|
||||||
if(event.valid === true) {
|
if(event.valid === true) {
|
||||||
this.sendMail(this.properties.admins);
|
this.sendMail(this.properties.admins);
|
||||||
} else {
|
|
||||||
this.errorMessage = 'Please fill in all the required fields!';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,29 +102,25 @@ export class ContactComponent implements OnInit {
|
||||||
community: this.fb.control('', Validators.required),
|
community: this.fb.control('', Validators.required),
|
||||||
message: this.fb.control('', Validators.required),
|
message: this.fb.control('', Validators.required),
|
||||||
recaptcha: this.fb.control('', Validators.required),
|
recaptcha: this.fb.control('', Validators.required),
|
||||||
});
|
})
|
||||||
this.errorMessage = '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private sendMail(admins: any) {
|
private sendMail(admins: any) {
|
||||||
this.showLoading = true;
|
this.sending = true;
|
||||||
this.subscriptions.push(this._emailService.contact(this.properties,
|
this.subscriptions.push(this._emailService.contact(this.properties,
|
||||||
Composer.composeEmailForNewCommunity(this.contactForm.value, admins),
|
Composer.composeEmailForNewCommunity(this.contactForm.value, admins),
|
||||||
this.contactForm.value.recaptcha).subscribe(
|
this.contactForm.value.recaptcha).subscribe(
|
||||||
res => {
|
res => {
|
||||||
this.showLoading = false;
|
|
||||||
if (res) {
|
if (res) {
|
||||||
|
this.sending = false;
|
||||||
this.reset();
|
this.reset();
|
||||||
this.modalOpen();
|
this.modalOpen();
|
||||||
} else {
|
} else {
|
||||||
this.errorMessage = 'Email sent failed! Please try again.';
|
this.handleError('Email <b>sent failed!</b> Please try again.');
|
||||||
this.contactForm.get('recaptcha').setValue('');
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
this.handleError('Email sent failed! Please try again.', error);
|
this.handleError('Email sent failed! Please try again.', error);
|
||||||
this.showLoading = false;
|
|
||||||
this.contactForm.get('recaptcha').setValue('');
|
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -141,10 +135,13 @@ export class ContactComponent implements OnInit {
|
||||||
this.modal.open();
|
this.modal.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
handleError(message: string, error) {
|
handleError(message: string, error = null) {
|
||||||
this.errorMessage = message;
|
if(error) {
|
||||||
console.log('Server responded: ' + error);
|
console.error(error);
|
||||||
this.showLoading = false;
|
}
|
||||||
|
NotificationHandler.rise(message, 'danger');
|
||||||
|
this.sending = false;
|
||||||
|
this.contactForm.get('recaptcha').setValue('');
|
||||||
}
|
}
|
||||||
|
|
||||||
public goToHome() {
|
public goToHome() {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 9222deed7b1a39d21284dd1c3121a31909767d3a
|
Subproject commit 2542d452be89e0ad740978d889e1a0f3e05c302f
|
|
@ -1 +1 @@
|
||||||
Subproject commit 9f0b25ae591095b9b9a31aa4cba7c98e3d012899
|
Subproject commit a6fbd5fdba27493d9b5bd59d92b632f08c7dbb96
|
Loading…
Reference in New Issue