email signature

This commit is contained in:
yuri
2015-03-09 15:48:13 +02:00
parent 82a96c743c
commit d0d3f39f5d
5 changed files with 46 additions and 13 deletions
@@ -19,7 +19,8 @@
"smtpEmailAddress": "Email Address",
"exportDelimiter": "Export Delimiter",
"receiveAssignmentEmailNotifications": "Receive Email Notifications upon Assignment",
"autoFollowEntityTypeList": "Auto-Follow"
"autoFollowEntityTypeList": "Auto-Follow",
"signature": "Email Signature"
},
"links": {
},
@@ -26,7 +26,19 @@
{
"label": "Misc",
"rows": [
[{"name": "exportDelimiter"}, {"name":"autoFollowEntityTypeList"}]
[{"name": "exportDelimiter"}, {"name":"autoFollowEntityTypeList"}],
[{
"name": "signature",
"params": {
"height": 70,
"toolbar": [
["style", ["bold", "italic", "underline", "clear"]],
["color", ["color"]],
["height", ["height"]],
["misc",["codeview"]]
]
}
}]
]
},
{
@@ -94,6 +94,10 @@
"translation": "Global.scopeNamesPlural",
"notStorable": true,
"tooltip": true
},
"signature": {
"type": "text",
"view": "Fields.Wysiwyg"
}
}
}
@@ -27,6 +27,17 @@ Espo.define('Views.Email.Record.Compose', 'Views.Record.Edit', function (Dep) {
sideView: false,
setup: function () {
Dep.prototype.setup.call(this);
var signature = this.getPreferences().get('signature');
if (signature) {
var body = this.model.get('body') || '';
body = '<br><p>' + signature + '</p>' + body;
this.model.set('body', body);
}
},
});
});
+16 -11
View File
@@ -29,9 +29,22 @@ Espo.define('Views.Fields.Wysiwyg', ['Views.Fields.Text', 'lib!Summernote'], fun
editTemplate: 'fields.wysiwyg.edit',
height: 250,
setup: function () {
Dep.prototype.setup.call(this);
this.height = this.params.height || this.height;
this.toolbar = this.params.toolbar || [
['style', ['style']],
['style', ['bold', 'italic', 'underline', 'clear']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['height', ['height']],
['table', ['table', 'link', 'picture']],
['misc',['codeview']]
];
this.listenTo(this.model, 'change:isHtml', function (model) {
if (!model.has('isHtml') || model.get('isHtml')) {
this.enableWysiwygMode();
@@ -97,7 +110,7 @@ Espo.define('Views.Fields.Wysiwyg', ['Views.Fields.Text', 'lib!Summernote'], fun
enableWysiwygMode: function () {
this.$summernote = this.$element.summernote({
height: 250,
height: this.height,
lang: this.getConfig().get('language'),
onImageUpload: function (files, editor, welEditable) {
var file = files[0];
@@ -132,20 +145,12 @@ Espo.define('Views.Fields.Wysiwyg', ['Views.Fields.Text', 'lib!Summernote'], fun
onblur: function () {
this.trigger('change')
}.bind(this),
toolbar: [
['style', ['style']],
['style', ['bold', 'italic', 'underline', 'clear']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['height', ['height']],
['table', ['table', 'link', 'picture']],
['misc',['codeview']]
]
toolbar: this.toolbar
});
},
disableWysiwygMode: function () {
var value = this.model.get(this.name);
var value = this.model.get(this.name).replace(/<br\s*\/?>/mg,"\n");
value = $('<div>').html(value).text();
this.model.set(this.name, value);
this.$element.destroy();