[DE] Refactorint mail merge settings

This commit is contained in:
Julia Radzhabova 2019-08-23 13:47:35 +03:00
parent 92cfcf2e4b
commit 6f94b986d6

View file

@ -91,6 +91,31 @@ define([
this.mergeMailData = undefined;
this.render();
},
render: function () {
this.$el.html(this.template({
scope: this
}));
},
setApi: function(api) {
this.api = api;
if (this.api) {
this.api.asc_registerCallback('asc_onPreviewMailMergeResult', _.bind(this.onPreviewMailMergeResult, this));
this.api.asc_registerCallback('asc_onEndPreviewMailMergeResult', _.bind(this.onEndPreviewMailMergeResult, this));
this.api.asc_registerCallback('asc_onStartMailMerge', _.bind(this.onStartMailMerge, this));
this.api.asc_registerCallback('asc_onSaveMailMerge', _.bind(this.onSaveMailMerge, this));
this.api.asc_registerCallback('asc_onEndAction', _.bind(this.onLongActionEnd, this));
Common.Gateway.on('setemailaddresses', _.bind(this.onSetEmailAddresses, this));
Common.Gateway.on('processmailmerge', _.bind(this.onProcessMailMerge, this));
}
return this;
},
createDelayedControls: function() {
var me = this,
_set = DE.enumLockMM;
this.btnInsField = new Common.UI.Button({
cls: 'btn-text-menu-default',
@ -133,31 +158,6 @@ define([
}
});
this.emptyDBControls.push(this.txtFieldNum);
},
render: function () {
this.$el.html(this.template({
scope: this
}));
},
setApi: function(api) {
this.api = api;
if (this.api) {
this.api.asc_registerCallback('asc_onPreviewMailMergeResult', _.bind(this.onPreviewMailMergeResult, this));
this.api.asc_registerCallback('asc_onEndPreviewMailMergeResult', _.bind(this.onEndPreviewMailMergeResult, this));
this.api.asc_registerCallback('asc_onStartMailMerge', _.bind(this.onStartMailMerge, this));
this.api.asc_registerCallback('asc_onSaveMailMerge', _.bind(this.onSaveMailMerge, this));
this.api.asc_registerCallback('asc_onEndAction', _.bind(this.onLongActionEnd, this));
Common.Gateway.on('setemailaddresses', _.bind(this.onSetEmailAddresses, this));
Common.Gateway.on('processmailmerge', _.bind(this.onProcessMailMerge, this));
}
return this;
},
createDelayedControls: function() {
var me = this,
_set = DE.enumLockMM;
this.btnEditData = new Common.UI.Button({
el: me.$el.find('#mmerge-button-edit-data'),
@ -760,8 +760,8 @@ define([
},
onStartMailMerge: function() {
this.btnInsField.menu.removeAll();
this.txtFieldNum.setValue(1);
this.btnInsField && this.btnInsField.menu.removeAll();
this.txtFieldNum && this.txtFieldNum.setValue(1);
this.ChangeSettings({
recipientsCount: this.api.asc_GetReceptionsCount(),
fieldsList: this.api.asc_GetMailMergeFieldsNameList()