add support when no email field is detected for self notifications
This commit is contained in:
parent
b5b8df90af
commit
19880b0d07
|
@ -32,10 +32,12 @@ angular.module('forms').directive('configureFormDirective', ['$rootScope', '$fil
|
|||
}
|
||||
];
|
||||
|
||||
$scope.emailFields = $scope.myform.form_fields.filter(function(field){
|
||||
$rootScope.emailFields = $scope.myform.form_fields.filter(function(field){
|
||||
return field.fieldType === 'email';
|
||||
});
|
||||
|
||||
$scope.formHasEmailField = ($rootScope.emailFields > 0);
|
||||
|
||||
$scope.go = function(tab){
|
||||
tab.active = true;
|
||||
$state.go(tab.route);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div class="row">
|
||||
<div class="col-sm-offset-2">
|
||||
<div class="row field">
|
||||
<div class="row field" ng-if="formHasEmailField">
|
||||
<div class="field-title col-sm-12">
|
||||
<h5>{{ 'SEND_NOTIFICATION_TO' | translate }}</h5>
|
||||
</div>
|
||||
|
@ -20,7 +20,10 @@
|
|||
</ui-select-choices>
|
||||
</ui-select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row field" ng-else>
|
||||
{{ 'NO_EMAIL_FIELD_WARNING' | translate }}
|
||||
</div>
|
||||
|
||||
<div class="row field">
|
||||
|
@ -41,7 +44,7 @@
|
|||
<h5>{{ 'EMAIL_SUBJECT' | translate }}</h5>
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<text-angular ng-model="myform.respondentNotifications.subject" ta-toolbar="[['addFieldVariable']]" ta-default-wrap="n"></text-angular>
|
||||
<text-angular class="email-subject" ng-model="myform.respondentNotifications.subject" ta-toolbar="[['insertEmailField']]" ta-default-wrap="n"></text-angular>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -51,7 +54,7 @@
|
|||
</div>
|
||||
|
||||
<div class="col-sm-12">
|
||||
<text-angular class="email-subject" ng-model="myform.respondentNotifications.htmlTemplate" ta-toolbar="[['bold','italics', 'addFieldVariable']]"></text-angular>
|
||||
<text-angular class="email-subject" ng-model="myform.respondentNotifications.htmlTemplate" ta-toolbar="[['bold','italics', 'insertField']]"></text-angular>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row field">
|
||||
<div class="row field" ng-if="formHasEmailField">
|
||||
<div class="field-title col-sm-12">
|
||||
<h5>{{ 'REPLY_TO' | translate }}</h5>
|
||||
</div>
|
||||
|
@ -41,7 +41,7 @@
|
|||
</div>
|
||||
|
||||
<div class="col-sm-12">
|
||||
<text-angular class="email-subject" ng-model="myform.selfNotifications.subject" ta-toolbar="[['addFieldVariable']]" ta-default-wrap="n"></text-angular>
|
||||
<text-angular class="email-subject" ng-model="myform.selfNotifications.subject" ta-toolbar="[['insertEmailField']]" ta-default-wrap="n"></text-angular>
|
||||
<div ng-bind="myform.selfNotifications.subject"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -52,7 +52,7 @@
|
|||
</div>
|
||||
|
||||
<div class="col-sm-12">
|
||||
<text-angular ng-model="myform.selfNotifications.htmlTemplate" ta-toolbar="[['bold','italics', 'addFieldVariable']]"></text-angular>
|
||||
<text-angular ng-model="myform.selfNotifications.htmlTemplate" ta-toolbar="[['bold','italics', 'insertField']]"></text-angular>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ angular.module('forms').run(['Menus',
|
|||
});
|
||||
}]).config(['$provide', function ($provide){
|
||||
$provide.decorator('taOptions', ['$delegate', 'taRegisterTool', '$translate', '$window', function(taOptions, taRegisterTool, $translate, $window) {
|
||||
taRegisterTool('addFieldVariable', {
|
||||
taRegisterTool('insertField', {
|
||||
display: '<div class="dropdown" uib-dropdown is-open="isopen">\
|
||||
<div class="dropdown-toggle" ng-disabled="isDisabled()" uib-dropdown-toggle>\
|
||||
<span>{{ "ADD_A_VARIABLE" | translate }}</span>\
|
||||
|
@ -67,6 +67,25 @@ angular.module('forms').run(['Menus',
|
|||
}
|
||||
});
|
||||
|
||||
taRegisterTool('insertEmailField', {
|
||||
display: '<div class="dropdown" uib-dropdown is-open="isopen">\
|
||||
<div class="dropdown-toggle" ng-disabled="isDisabled()" uib-dropdown-toggle>\
|
||||
<span>{{ "ADD_A_VARIABLE" | translate }}</span>\
|
||||
<b class="caret"></b>\
|
||||
</div>\
|
||||
<ul class="dropdown-menu">\
|
||||
<li ng-repeat="field in $root.email_fields" ng-click="onClickField(field._id, field.title)">\
|
||||
{{field.title}}\
|
||||
</li>\
|
||||
</ul>\
|
||||
</div>',
|
||||
onClickField: function(field_id, field_name){
|
||||
this.$editor().wrapSelection('insertHTML', '<var class="fieldVariable tag" contenteditable="false" id="' + field_id + '">' + field_name + '</var>', true);
|
||||
},
|
||||
action: function(){
|
||||
}
|
||||
});
|
||||
|
||||
return taOptions;
|
||||
}]);
|
||||
}]);
|
Loading…
Reference in a new issue