Project

General

Profile

« Previous | Next » 

Revision 54443

Added by Sofia Baltzi over 5 years ago

Move formatEmailBody to composer

View differences:

modules/uoa-connect-portal/trunk/src/app/utils/subscribe/invite/invite.component.ts
8 8
import {Email}                                           from '../../../openaireLibrary/utils/email/email';
9 9
import {Body}                                            from '../../../openaireLibrary/utils/email/body';
10 10
import {Validator}                                       from '../../../openaireLibrary/utils/email/validator';
11
import {Composer}                                        from '../../../openaireLibrary/utils/email/composer';
11 12

  
12 13
import {EnvProperties}                                   from '../../../openaireLibrary/utils/properties/env-properties';
13 14
import {EmailService}                                    from '../../../openaireLibrary/utils/email/email.service';
......
45 46

  
46 47
  private ckeditorContent: string;
47 48

  
48
  // 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>';
49 49
  public defaultBody ='';
50 50

  
51 51
  public communityIdParam = {};
......
86 86
                this.fullname = Session.getUserFullName();
87 87
                console.log("Fullname from session " + Session.getUserFullName());
88 88
                this.defaultBody = '<p>You are invited to subscribe to <a href="https://beta.' + this.communityId + '.openaire.eu/">' + this.community.title + '</a> dashboard.'
89
                                   + '<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>';
89
                                   + '<br>The purpose of this dashboard  is to gather, link &amp; monitor the research results related to your community.</p>'
90
                                   + '<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>';
90 91

  
91 92
                 // TODO move the initialisation
92 93
                 this.body = {fromMessage: ", on behalf of ", fromName: this.fullname, paragraphs: this.defaultBody, signature: "OpenAIRE team", note: ""};
......
191 192

  
192 193
  public composeEmail() {
193 194
      // this.email.subject = "[OpenAIRE-Connect] Community_name";
194
      this.email.body = this.formatEmailBody();
195
      this.email.body = Composer.formatEmailBodyForInvitation(this.body);
195 196
  }
196 197

  
197
  public formatEmailBody(): string {
198
      let fromMessageAndName = "";
199

  
200
      if (this.body.fromName != "") {
201
        fromMessageAndName = "<span>" + this.body.fromMessage + this.body.fromName + "</span>";
202
      }
203

  
204
      let formattedEmail = "<div style='font-size:14px;'>"
205
                           + this.body.paragraphs
206
                           + "<p>" + this.body.signature + fromMessageAndName + "<br>"
207
                           + "<a href='https://www.openaire.eu'>www.openaire.eu</a>"
208
                           + "</p>"
209
                           + "</div>";
210

  
211
      return formattedEmail;
212
  }
213

  
214 198
  public handleError(error) {
215 199
    if(error.status == '401') {
216 200
      this.status = this.errorCodes.FORBIDDEN;

Also available in: Unified diff