Move formatEmailBody to composer

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@54443 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
sofia.baltzi 2018-12-18 12:18:49 +00:00
parent d0931d2a27
commit 7871be91b0
1 changed files with 4 additions and 20 deletions

View File

@ -8,6 +8,7 @@ import {ConnectHelper} from '../../../openaire
import {Email} from '../../../openaireLibrary/utils/email/email';
import {Body} from '../../../openaireLibrary/utils/email/body';
import {Validator} from '../../../openaireLibrary/utils/email/validator';
import {Composer} from '../../../openaireLibrary/utils/email/composer';
import {EnvProperties} from '../../../openaireLibrary/utils/properties/env-properties';
import {EmailService} from '../../../openaireLibrary/utils/email/email.service';
@ -45,7 +46,6 @@ export class InviteComponent implements OnInit {
private ckeditorContent: string;
// public defaultBody = '<p>OpenAIRE invites you to subscribe in <a href="https://beta.egi.openaire.eu">_Community_name_</a> dashboard. </p><p>The community dashboard is part of the <a href="https://beta.egi.openaire.eu">OpenAIRE-Connect</a> project.</p>';
public defaultBody ='';
public communityIdParam = {};
@ -86,7 +86,8 @@ export class InviteComponent implements OnInit {
this.fullname = Session.getUserFullName();
console.log("Fullname from session " + Session.getUserFullName());
this.defaultBody = '<p>You are invited to subscribe to <a href="https://beta.' + this.communityId + '.openaire.eu/">' + this.community.title + '</a> dashboard.'
+ '<br>The purpose of this dashboard is to gather, link &amp; monitor the research results related to your community.</p><p>The community dashboard is part of the <a href="https://connect.openaire.eu/">OpenAIRE-Connect</a> project and currently is in BETA version.</p>';
+ '<br>The purpose of this dashboard is to gather, link &amp; monitor the research results related to your community.</p>'
+ '<p>The community dashboard is part of the <a href="https://connect.openaire.eu/">OpenAIRE-Connect</a> project and currently is in BETA version.</p>';
// TODO move the initialisation
this.body = {fromMessage: ", on behalf of ", fromName: this.fullname, paragraphs: this.defaultBody, signature: "OpenAIRE team", note: ""};
@ -191,24 +192,7 @@ export class InviteComponent implements OnInit {
public composeEmail() {
// this.email.subject = "[OpenAIRE-Connect] Community_name";
this.email.body = this.formatEmailBody();
}
public formatEmailBody(): string {
let fromMessageAndName = "";
if (this.body.fromName != "") {
fromMessageAndName = "<span>" + this.body.fromMessage + this.body.fromName + "</span>";
}
let formattedEmail = "<div style='font-size:14px;'>"
+ this.body.paragraphs
+ "<p>" + this.body.signature + fromMessageAndName + "<br>"
+ "<a href='https://www.openaire.eu'>www.openaire.eu</a>"
+ "</p>"
+ "</div>";
return formattedEmail;
this.email.body = Composer.formatEmailBodyForInvitation(this.body);
}
public handleError(error) {