Add a first draft for invite page
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@53695 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
03b8ed2a8b
commit
81407f0627
|
@ -41,6 +41,7 @@
|
|||
"datatables.net": "^1.10.16",
|
||||
"datatables.net-dt": "^1.10.16",
|
||||
"jquery": "^3.2.1",
|
||||
"ng2-ckeditor": "1.1.9",
|
||||
"ngx-json-ld": "0.1.6",
|
||||
"rxjs": "^5.4.2",
|
||||
"ts-md5": "^1.2.0",
|
||||
|
|
|
@ -9,6 +9,7 @@ import { OpenaireErrorPageComponent } from './error/errorPage.component';
|
|||
const routes: Routes = [
|
||||
{ path: '', loadChildren: './communitywrapper/communityWrapper.module#CommunityWrapperModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
|
||||
{ path: 'my-communities', loadChildren: './my-communities/communities.module#MyCommunitiesModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
|
||||
{ path: 'invite', loadChildren: './utils/subscribe/invite/invite.module#InviteModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
|
||||
{ path: 'about', loadChildren: './htmlPages/about/aboutPage.module#AboutPageModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
|
||||
{ path: 'content', loadChildren: './content/contentPage.module#ContentPageModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
|
||||
{ path: 'organizations', loadChildren: './htmlPages/organizations/organizationsPage.module#OrganizationsPageModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
|
||||
|
|
|
@ -6,6 +6,8 @@ import {RouterModule} from '@angular/router';
|
|||
import {BrowserModule} from '@angular/platform-browser';
|
||||
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
|
||||
|
||||
import {CKEditorModule} from 'ng2-ckeditor';
|
||||
|
||||
import {AppComponent} from './app.component';
|
||||
import {OpenaireErrorPageComponent} from './error/errorPage.component';
|
||||
|
||||
|
@ -31,6 +33,8 @@ import {CommunitiesService} from './openaireLibrary/connect/communi
|
|||
CommonModule,
|
||||
HttpModule,
|
||||
ErrorModule,
|
||||
CKEditorModule,
|
||||
FormsModule,
|
||||
NavigationBarModule, FeedbackModule, BottomModule,
|
||||
CookieLawModule,
|
||||
BrowserModule.withServerTransition({appId: 'my-app'}),
|
||||
|
|
|
@ -170,3 +170,5 @@
|
|||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<invite longView=false></invite>
|
||||
|
|
|
@ -15,7 +15,7 @@ import {CommunityService} from '../openaireLibrary/connect/community/community.s
|
|||
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
|
||||
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||
import {SubscribeModule} from '../utils/subscribe/subscribe.module';
|
||||
import {InviteModule} from '../utils/subscribe/invite.module';
|
||||
import {InviteModule} from '../utils/subscribe/invite/invite.module';
|
||||
import {ManageModule} from '../utils/manage/manage.module';
|
||||
|
||||
import {StatisticsModule} from "../statistics/statistics.module";
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
import {NgModule} from '@angular/core';
|
||||
import {RouterModule} from '@angular/router';
|
||||
|
||||
import {InviteComponent} from './invite.component';
|
||||
import {FreeGuard} from '../../../openaireLibrary/login/freeGuard.guard';
|
||||
import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: InviteComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] }
|
||||
|
||||
])
|
||||
]
|
||||
})
|
||||
export class InviteRoutingModule { }
|
|
@ -0,0 +1,166 @@
|
|||
<div *ngIf="longView == true">
|
||||
<div class=" uk-section uk-margin-small-top tm-middle uk-container" id="tm-main">
|
||||
|
||||
<div class="uk-container uk-margin-bottom">
|
||||
|
||||
<div id="invite" class=" uk-card uk-card-default uk-padding">
|
||||
<div class="uk-text-large uk-text-center uk-width-5-6@l uk-width ">Invite users to subscribe</div>
|
||||
<!--table *ngIf="communityId != null && community != null && !showLoading && !errorMessage" class="uk-table uk-align-center"-->
|
||||
<table class="uk-table uk-align-center">
|
||||
<tbody>
|
||||
<!-- <tr>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<li>Invite by email</li>
|
||||
</td>
|
||||
</tr> -->
|
||||
<tr>
|
||||
<td for="from" class="uk-text-bold uk-width-1-3@xl uk-width-1-3@m uk-width-1-3@s uk-text-right">From:</td>
|
||||
<td class="uk-text-left uk-width-expand">
|
||||
<input placeholder="Type your name" type="text"
|
||||
class="form-control uk-input uk-width-large@l uk-width-medium@s" [(ngModel)] = "body.fromName" id="from">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td for="email.recipients[0]" class="uk-text-bold uk-text-right">To <span class="uk-text-danger uk-text-bold">*</span> :</td>
|
||||
<td class="uk-text-left">
|
||||
|
||||
<!-- <div *ngIf="!email.recipients[1].match('^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$')"
|
||||
class="uk-width-large uk-text-danger uk-text-small uk-margin-top"> Please add a valid email. </div> -->
|
||||
<input placeholder="email" type="text"
|
||||
class="form-control uk-input uk-width-large@l uk-width-medium@s" [(ngModel)] = "email.recipients[0]" id="recipients"
|
||||
required >
|
||||
{{email.recipients}}
|
||||
<div class="uk-width-medium uk-text-muted uk-text-small style=display:none">separate multiple emails with a comma</div>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="boundary-align uk-panel uk-placeholder">
|
||||
|
||||
<table class="uk-table uk-align-center">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="uk-text-bold uk-width-1-4@xl uk-width-1-4@m uk-width-1-4@s uk-text-right"></td>
|
||||
<td class="uk-text-left">
|
||||
{{body.salutation}}<br>
|
||||
<span *ngIf="body.fromName == ''" class="uk-text-muted">
|
||||
<i>{{body.fromMessage}}...</i>
|
||||
</span>
|
||||
<span *ngIf="body.fromName !=''">
|
||||
{{body.fromMessage}}
|
||||
<b>{{body.fromName}}</b>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td for="email.body" class="uk-text-bold uk-text-right">Message:</td>
|
||||
<td class="uk-text-left">
|
||||
<!-- <ckeditor
|
||||
debounce="400"
|
||||
[config]="{ extraAllowedContent: '* [uk-*](*) ; span', disallowedContent: 'script; *[on*]', removeButtons: 'Save,NewPage,DocProps,Preview,Print',
|
||||
extraPlugins: 'divarea'}">
|
||||
<id="contentTag"-->
|
||||
<!--(ready)="onReady($event)"-->
|
||||
<!--(focus)="onFocus($event)"-->
|
||||
<!--[config]="{uiColor: '#99000'}"-->
|
||||
<!--(blur)="onBlur($event)"-->
|
||||
<!--(change)="onChange($event)"-->
|
||||
<!--/ckeditor> -->
|
||||
<!-- <textarea type="text"
|
||||
class="form-control uk-input uk-width-large@l uk-width-medium@s" [(ngModel)] = "email.body" id="message">
|
||||
</textarea> -->
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="uk-text-left">
|
||||
{{body.closing}}<br>
|
||||
{{body.signature}}
|
||||
</td>
|
||||
</tr>
|
||||
<!-- <tr>
|
||||
<td for="email.subject" class="uk-text-bold uk-text-right">Subject :</td>
|
||||
<td class="uk-text-left">
|
||||
<textarea type="text"
|
||||
class="form-control uk-input uk-width-large@l uk-width-medium@s" [(ngModel)] = "email.subject" id="subject">
|
||||
</textarea>
|
||||
</td>
|
||||
</tr> -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<table class="uk-table uk-align-center">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="uk-text-bold uk-width-3-5@xl uk-width-3-5@m uk-width-3-5@s uk-text-right"></td>
|
||||
<td><div class="uk-padding uk-padding-remove-top uk-padding-remove-bottom uk-text-danger uk-text-bold">* Required fields</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="uk-text-right"></td>
|
||||
<td>
|
||||
<div class="uk-grid-margin uk-first-column uk-align-center uk-text-left uk-padding uk-padding-remove-top uk-padding-remove-bottom">
|
||||
<button class="uk-button uk-button-primary" (click)="invite()">Invite</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- <tr>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<li>Invite by link</li>
|
||||
</td>
|
||||
</tr> -->
|
||||
<!-- <tr>
|
||||
<td for="link" class="uk-text-bold uk-text-right">Link :</td>
|
||||
<td class="uk-text-left">
|
||||
<input placeholder="link" type="text"
|
||||
class="form-control uk-input uk-width-large@l uk-width-medium@s" id="link"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="uk-text-right"></td>
|
||||
<td>
|
||||
<div class="uk-grid-margin uk-first-column uk-align-center uk-text-left uk-padding uk-padding-remove-top uk-padding-remove-bottom">
|
||||
<button class="uk-button" (click)="resetForm(communityId)">Cancel</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr> -->
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="uk-text-left">
|
||||
<span uk-icon="chevron-left"></span><span class="uk-margin-small-left"><a href="invite">Back</a></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div *ngIf="longView =='false'">
|
||||
<div class="uk-width-large@m uk-width-1-1@s">
|
||||
<div class="uk-card uk-card-default uk-card-body">
|
||||
<div class="uk-text-center uk-text-large">
|
||||
<div> Invite users to subscribe </div>
|
||||
<div uk-grid>
|
||||
<div class="uk-width-1-6">
|
||||
<span class="uk-margin-small-right" uk-icon="social"></span>
|
||||
</div>
|
||||
<div class="uk-width-3-5">
|
||||
<input placeholder="" type="text"
|
||||
class="form-control uk-input" [(ngModel)] = "email.recipients[0]" id="recipients"
|
||||
required >
|
||||
</div>
|
||||
<div class="uk-width-1-6">
|
||||
<button class="uk-button" (click)="invite()">Invite</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="uk-width-medium uk-text-muted uk-text-small style=display:none">separate multiple emails with a comma</div>
|
||||
<div class="uk-text-right">
|
||||
<span class="uk-margin-small-left" uk-icon="cog"></span><span class="uk-margin-small-left uk-text-small"><a href="invite">customise it</a></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
|
@ -0,0 +1,79 @@
|
|||
import {Component, OnInit, Input} from '@angular/core';
|
||||
import {SimpleChanges, OnChanges} from '@angular/core';
|
||||
import {FormGroup, FormArray, FormBuilder, Validators} from "@angular/forms";
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
|
||||
import {Email} from '../../../openaireLibrary/utils/email/email';
|
||||
import {Body} from '../../../openaireLibrary/utils/email/body';
|
||||
|
||||
import {EnvProperties} from '../../../openaireLibrary/utils/properties/env-properties';
|
||||
import {EmailService} from '../../../openaireLibrary/utils/email/email.service';
|
||||
|
||||
@Component({
|
||||
selector: 'invite',
|
||||
templateUrl: './invite.component.html',
|
||||
})
|
||||
|
||||
export class InviteComponent implements OnInit {
|
||||
|
||||
@Input() longView: boolean = true;
|
||||
|
||||
private properties: EnvProperties = null;
|
||||
public email: Email;
|
||||
public body: Body;
|
||||
|
||||
private ckeditorContent: string;
|
||||
|
||||
public defaultBody = '<div>Dear Sir/Madame,<br> <p><span>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><p>Kind regards,<br>OpenAIRE team</p></div>'
|
||||
public defaultBody2 = 'OpenAIRE invites you to subscribe in Community_name dashboard. </p><p>The community dashboard is part of the OpenAIRE-Connect</a> project</p>'
|
||||
|
||||
@Input() communityId = null;
|
||||
|
||||
constructor (
|
||||
private route: ActivatedRoute,
|
||||
private _router: Router,
|
||||
public _fb: FormBuilder,
|
||||
private _emailService: EmailService) { }
|
||||
|
||||
|
||||
public ngOnInit() {
|
||||
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
this.properties = data.envSpecific;
|
||||
this.body = {salutation: "Dear Sir/Madame,", fromMessage: "On behalf of ", fromName: "", paragraphs: "", closing: "Kind regards,", signature: "OpenAIRE team"};
|
||||
this.email = {body: "", subject: "", recipients: []};
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public invite() {
|
||||
if (this.email.recipients != null) {
|
||||
this.composeEmail();
|
||||
console.log(this.email.body);
|
||||
|
||||
this._emailService.sendEmail(this.properties.sendMailUrl, this.email).subscribe(
|
||||
res => console.log("Mail has been sent successfully!")
|
||||
,
|
||||
error => console.log(error)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public composeEmail() {
|
||||
this.email.subject = "Argiro is going to tell me about the subject";
|
||||
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>" + this.body.salutation + "<br>" +
|
||||
"<p>" + fromMessageAndName + "..." + "</p>" +
|
||||
"<p>" + this.body.closing + "<br>" + this.body.signature + "</p></div>";
|
||||
|
||||
return formattedEmail;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
import {NgModule} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {RouterModule} from '@angular/router';
|
||||
import {CKEditorModule} from 'ng2-ckeditor';
|
||||
|
||||
import {InviteComponent} from './invite.component';
|
||||
import {InviteRoutingModule} from './invite-routing.module';
|
||||
|
||||
import {PreviousRouteRecorder} from '../../../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||
|
||||
import {FreeGuard} from '../../../openaireLibrary/login/freeGuard.guard';
|
||||
import {EmailService} from '../../../openaireLibrary/utils/email/email.service';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule, RouterModule, InviteRoutingModule, CKEditorModule
|
||||
],
|
||||
declarations: [
|
||||
InviteComponent
|
||||
],
|
||||
providers: [
|
||||
FreeGuard, PreviousRouteRecorder,
|
||||
EmailService
|
||||
],
|
||||
exports: [
|
||||
InviteComponent
|
||||
]
|
||||
})
|
||||
|
||||
export class InviteModule { }
|
|
@ -103,6 +103,8 @@
|
|||
"searchLinkToAdvancedOrganizations" : "/search/advanced/organizations",
|
||||
"searchLinkToAdvancedPeople" : "/search/advanced/people",
|
||||
|
||||
"sendMailUrl": "http://scoobydoo.di.uoa.gr:8080/uoa-admin-tools/sendMail",
|
||||
|
||||
"lastIndexInformationLink" : "https://www.openaire.eu/aggregation-and-content-provision-workflows",
|
||||
"showLastIndexInformationLink" : true,
|
||||
|
||||
|
|
|
@ -61,6 +61,8 @@
|
|||
<script src="assets/common-assets/citeproc.js"></script>
|
||||
<script src="assets/common-assets/common/uikit.js"></script>
|
||||
<script src="assets/common-assets/common/uikit-icons-max.js"></script>
|
||||
<script src="https://cdn.ckeditor.com/4.5.11/full-all/ckeditor.js"></script>
|
||||
<script src="config.js"></script>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
console.log("Is ready - load uikit ***")
|
||||
|
|
Loading…
Reference in New Issue