added subject quilljs fields for self and respondent notifications
This commit is contained in:
parent
98d874783f
commit
f619b6e1ca
5 changed files with 60 additions and 30 deletions
|
@ -4,8 +4,9 @@ var JSDOM = jsdom.JSDOM;
|
|||
|
||||
module.exports = {
|
||||
send: function(emailSettings, emailTemplateVars, smtpTransport, cb){
|
||||
var parsedTemplate = this.parseTemplate(emailSettings.htmlTemplate, emailTemplateVars);
|
||||
var parsedSubject = this.parseTemplate(emailSettings.subject, emailTemplateVars);
|
||||
var parsedTemplate = this.parseTemplate(emailSettings.htmlTemplate, emailTemplateVars, false);
|
||||
var parsedSubject = this.parseTemplate(emailSettings.subject, emailTemplateVars, true);
|
||||
|
||||
var mailOptions = {
|
||||
replyTo: emailSettings.fromEmails,
|
||||
from: 'noreply@tellform.com',
|
||||
|
@ -19,9 +20,8 @@ module.exports = {
|
|||
});
|
||||
},
|
||||
|
||||
parseTemplate: function(emailTemplate, emailTemplateVars){
|
||||
parseTemplate: function(emailTemplate, emailTemplateVars, onlyText){
|
||||
var dom = new JSDOM('<!doctype html>'+emailTemplate);
|
||||
debugger;
|
||||
|
||||
Object.keys(emailTemplateVars).forEach(function (key) {
|
||||
var elem = dom.window.document.querySelector("span.placeholder-tag[data-id='" + key + "']");
|
||||
|
@ -30,7 +30,6 @@ module.exports = {
|
|||
}
|
||||
});
|
||||
|
||||
debugger;
|
||||
//Removed unused variables
|
||||
//TODO: Currently querySelectorAll not working in JSDOM
|
||||
/*
|
||||
|
@ -40,6 +39,9 @@ module.exports = {
|
|||
}
|
||||
})
|
||||
*/
|
||||
if(onlyText){
|
||||
return dom.window.document.documentElement.textContent;
|
||||
}
|
||||
return dom.serialize();
|
||||
},
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
width: 118px;
|
||||
}
|
||||
|
||||
.ql-picker.ql-placeholder > span.ql-picker-label::before {
|
||||
content: 'Placeholders';
|
||||
.ql-picker.ql-placeholder > span.ql-picker-label:before {
|
||||
content: attr(data-before);
|
||||
}
|
||||
|
||||
.ql-picker.ql-placeholder > span.ql-picker-options > span.ql-picker-item::before {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('forms').directive('configureFormDirective', ['$rootScope', '$filter', '$state',
|
||||
function ($rootScope, $filter, $state) {
|
||||
angular.module('forms').directive('configureFormDirective', ['$rootScope', '$filter', '$state', '$translate', '$timeout', '$window',
|
||||
function ($rootScope, $filter, $state, $translate, $timeout, $window) {
|
||||
return {
|
||||
templateUrl: 'modules/forms/admin/views/directiveViews/form/configure-form.client.view.html',
|
||||
restrict: 'E',
|
||||
|
@ -24,7 +24,7 @@ angular.module('forms').directive('configureFormDirective', ['$rootScope', '$fil
|
|||
};
|
||||
}),
|
||||
className: 'placeholder-tag',
|
||||
delimiters: ['', ''],
|
||||
delimiters: ['', '']
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -66,6 +66,16 @@ angular.module('forms').directive('configureFormDirective', ['$rootScope', '$fil
|
|||
setActiveTab();
|
||||
|
||||
$scope.$on("$stateChangeSuccess", setActiveTab());
|
||||
|
||||
$scope.$on('$viewContentLoaded', function ($evt, data) {
|
||||
console.log('hello');
|
||||
$timeout(function(){
|
||||
if(!$('.ql-picker.ql-placeholder > span.ql-picker-label').attr('data-before')){
|
||||
$('.ql-picker.ql-placeholder > span.ql-picker-label').attr('data-before', $translate.instant('ADD_VARIABLE_BUTTON'));
|
||||
}
|
||||
}, 500);
|
||||
console.log($('.ql-picker.ql-placeholder > span.ql-picker-label'));
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<i class="status-light status-light-off fa fa-circle" ng-if="!myform.respondentNotifications.enabled"></i>
|
||||
</div>
|
||||
<div class="notification-row">
|
||||
<h5>{{ 'ENABLE_RESPONDENT_NOTIFICATIONS' | translate }}</h5>
|
||||
<h4>{{ 'ENABLE_RESPONDENT_NOTIFICATIONS' | translate }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="notification-row">
|
||||
|
@ -29,7 +29,7 @@
|
|||
|
||||
<div class="row field" ng-if="formHasEmailField">
|
||||
<div class="field-title col-sm-12">
|
||||
<h5>{{ 'SEND_NOTIFICATION_TO' | translate }}:</h5>
|
||||
<h4>{{ 'SEND_NOTIFICATION_TO' | translate }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 field-input">
|
||||
|
@ -47,7 +47,7 @@
|
|||
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-12">
|
||||
<h5>{{ 'REPLY_TO' | translate }}:</h5>
|
||||
<h4>{{ 'REPLY_TO' | translate }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 field-input">
|
||||
|
@ -60,17 +60,29 @@
|
|||
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-12">
|
||||
<h5>{{ 'EMAIL_SUBJECT' | translate }}:</h5>
|
||||
<h4>{{ 'EMAIL_SUBJECT' | translate }}</h4>
|
||||
</div>
|
||||
<div class="col-sm-12 field-input">
|
||||
<text-angular class="email-subject" ng-model="myform.respondentNotifications.subject" ta-toolbar="[['insertField']]" ta-default-wrap="n" ta-unsafe-sanitizer="true">
|
||||
</text-angular>
|
||||
<ng-quill-editor modules="customModules"
|
||||
ng-model="myform.respondentNotifications.subject">
|
||||
<ng-quill-toolbar>
|
||||
<div id="ng-quill-toolbar">
|
||||
<span class="ql-formats">
|
||||
<select class="ql-placeholder">
|
||||
<option ng-repeat="placeholder in customModules.placeholder.placeholders" value="{{placeholder.id}}">
|
||||
{{placeholder.label}}
|
||||
</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
</ng-quill-toolbar>
|
||||
</ng-quill-editor>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-12">
|
||||
<h5>{{ 'EMAIL_MESSAGE' | translate }}</h5>
|
||||
<h4>{{ 'EMAIL_MESSAGE' | translate }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 field-input">
|
||||
|
@ -92,7 +104,6 @@
|
|||
</div>
|
||||
</ng-quill-toolbar>
|
||||
</ng-quill-editor>
|
||||
<div ng-bind="myform.respondentNotifications.htmlTemplate"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
</div>
|
||||
|
||||
<div class='notification-row'>
|
||||
<h5>{{ 'ENABLE_SELF_NOTIFICATIONS' | translate }}</h5>
|
||||
<h4>{{ 'ENABLE_SELF_NOTIFICATIONS' | translate }}</h4>
|
||||
</div>
|
||||
|
||||
<div class='notification-row'>
|
||||
|
@ -21,7 +21,7 @@
|
|||
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-12">
|
||||
<h5>{{ 'SEND_NOTIFICATION_TO' | translate }}</h5>
|
||||
<h4>{{ 'SEND_NOTIFICATION_TO' | translate }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 field-input">
|
||||
|
@ -34,7 +34,7 @@
|
|||
|
||||
<div class="row field" ng-if="formHasEmailField">
|
||||
<div class="field-title col-sm-12">
|
||||
<h5>{{ 'REPLY_TO' | translate }}</h5>
|
||||
<h4>{{ 'REPLY_TO' | translate }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 ui-select field-input">
|
||||
|
@ -52,21 +52,30 @@
|
|||
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-12">
|
||||
<h5>{{ 'EMAIL_SUBJECT' | translate }}</h5>
|
||||
<h4>{{ 'EMAIL_SUBJECT' | translate }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 field-input">
|
||||
<!--
|
||||
<text-angular class="email-subject" ng-model="myform.selfNotifications.subject"
|
||||
ta-toolbar="[['insertField']]"
|
||||
ta-unsafe-sanitizer="true" ta-default-wrap="n"></text-angular>
|
||||
-->
|
||||
<ng-quill-editor modules="customModules"
|
||||
ng-model="myform.selfNotifications.subject">
|
||||
<ng-quill-toolbar>
|
||||
<div id="ng-quill-toolbar">
|
||||
<span class="ql-formats">
|
||||
<select class="ql-placeholder">
|
||||
<option ng-repeat="placeholder in customModules.placeholder.placeholders" value="{{placeholder.id}}">
|
||||
{{placeholder.label}}
|
||||
</option>
|
||||
</select>
|
||||
</span>
|
||||
</div>
|
||||
</ng-quill-toolbar>
|
||||
</ng-quill-editor>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-12">
|
||||
<h5>{{ 'EMAIL_MESSAGE' | translate }}</h5>
|
||||
<h4>{{ 'EMAIL_MESSAGE' | translate }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 field-input">
|
||||
|
@ -89,8 +98,6 @@
|
|||
</ng-quill-toolbar>
|
||||
</ng-quill-editor>
|
||||
</div>
|
||||
|
||||
<div ng-bind="myform.selfNotifications.htmlTemplate"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in a new issue