This commit is contained in:
Yuri Kuznetsov
2022-10-21 17:09:39 +03:00
parent f4a3a3fbd3
commit 7266cc96c9
6 changed files with 58 additions and 55 deletions

View File

@@ -47,11 +47,7 @@ define('crm:views/calendar/modals/edit-view', ['views/modal', 'model'], function
setup: function () {
var id = this.options.id;
if (id) {
this.isNew = false;
} else {
this.isNew = true;
}
this.isNew = !id;
var calendarViewDataList = this.getPreferences().get('calendarViewDataList') || [];
@@ -159,16 +155,16 @@ define('crm:views/calendar/modals/edit-view', ['views/modal', 'model'], function
this.getPreferences()
.save(
{
'calendarViewDataList': calendarViewDataList
'calendarViewDataList': calendarViewDataList,
},
{patch: true}
)
.then(() =>{
.then(() => {
Espo.Ui.notify(false);
this.trigger('after:save', data);
this.remove();
})
.fail(() => {
.catch(() => {
this.enableButton('remove');
this.enableButton('save');
});
@@ -206,7 +202,7 @@ define('crm:views/calendar/modals/edit-view', ['views/modal', 'model'], function
this.trigger('after:remove');
this.remove();
})
.fail(() => {
.catch(() => {
this.enableButton('remove');
this.enableButton('save');
});

View File

@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/admin/label-manager/edit', 'view', function (Dep) {
define('views/admin/label-manager/edit', ['view'], function (Dep) {
return Dep.extend({
@@ -155,7 +155,7 @@ define('views/admin/label-manager/edit', 'view', function (Dep) {
this.getLanguage().loadSkipCache();
})
.fail(() => {
.catch(() => {
this.$save.removeClass('disabled').removeAttr('disabled');
this.$cancel.removeClass('disabled').removeAttr('disabled');
});
@@ -210,7 +210,6 @@ define('views/admin/label-manager/edit', 'view', function (Dep) {
getCategoryData: function (category) {
return this.scopeData[category] || {};
},
});
});

View File

@@ -151,7 +151,9 @@ define('views/admin/template-manager/edit', ['view', 'model'], function (Dep, Mo
}
Espo.Ui.notify(this.translate('saving', 'messages'));
this.ajaxPostRequest('TemplateManager/action/saveTemplate', data).then(function () {
this.ajaxPostRequest('TemplateManager/action/saveTemplate', data)
.then(() => {
this.setConfirmLeaveOut(false);
this.attributes.body = data.body;
@@ -162,21 +164,23 @@ define('views/admin/template-manager/edit', ['view', 'model'], function (Dep, Mo
this.$resetToDefault.removeClass('disabled').removeAttr('disabled');
Espo.Ui.success(this.translate('Saved'));
}.bind(this)).fail(function () {
})
.catch(() => {
this.$save.removeClass('disabled').removeAttr('disabled');
this.$cancel.removeClass('disabled').removeAttr('disabled');
this.$resetToDefault.removeClass('disabled').removeAttr('disabled');
}.bind(this));
});
},
actionCancel: function () {
this.model.set('subject', this.attributes.subject);
this.model.set('body', this.attributes.body);
this.setConfirmLeaveOut(false);
},
actionResetToDefault: function () {
this.confirm(this.translate('confirmation', 'messages'), function () {
this.confirm(this.translate('confirmation', 'messages'), () => {
this.$save.addClass('disabled').attr('disabled');
this.$cancel.addClass('disabled').attr('disabled');
this.$resetToDefault.addClass('disabled').attr('disabled');
@@ -192,26 +196,27 @@ define('views/admin/template-manager/edit', ['view', 'model'], function (Dep, Mo
Espo.Ui.notify(this.translate('pleaseWait', 'messages'));
this.ajaxPostRequest('TemplateManager/action/resetTemplate', data).then(function (returnData) {
this.$save.removeClass('disabled').removeAttr('disabled');
this.$cancel.removeClass('disabled').removeAttr('disabled');
this.$resetToDefault.removeClass('disabled').removeAttr('disabled');
this.ajaxPostRequest('TemplateManager/action/resetTemplate', data)
.then(returnData => {
this.$save.removeClass('disabled').removeAttr('disabled');
this.$cancel.removeClass('disabled').removeAttr('disabled');
this.$resetToDefault.removeClass('disabled').removeAttr('disabled');
this.attributes.body = returnData.body;
this.attributes.subject = returnData.subject;
this.attributes.body = returnData.body;
this.attributes.subject = returnData.subject;
this.model.set('subject', returnData.subject);
this.model.set('body', returnData.body);
this.setConfirmLeaveOut(false);
Espo.Ui.notify(false);
}.bind(this)).fail(function () {
this.$save.removeClass('disabled').removeAttr('disabled');
this.$cancel.removeClass('disabled').removeAttr('disabled');
this.$resetToDefault.removeClass('disabled').removeAttr('disabled');
}.bind(this));
}.bind(this));
}
this.model.set('subject', returnData.subject);
this.model.set('body', returnData.body);
this.setConfirmLeaveOut(false);
Espo.Ui.notify(false);
})
.catch(() => {
this.$save.removeClass('disabled').removeAttr('disabled');
this.$cancel.removeClass('disabled').removeAttr('disabled');
this.$resetToDefault.removeClass('disabled').removeAttr('disabled');
});
});
},
});
});

View File

@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/email-account/fields/folder', 'views/fields/base', function (Dep) {
define('views/email-account/fields/folder', ['views/fields/base'], function (Dep) {
return Dep.extend({
@@ -55,24 +55,26 @@ define('views/email-account/fields/folder', 'views/fields/base', function (Dep)
data.id = this.model.id;
}
Espo.Ajax.postRequest(this.getFoldersUrl, data).then(function (folders) {
Espo.Ajax.postRequest(this.getFoldersUrl, data).then(folders => {
this.createView('modal', 'views/email-account/modals/select-folder', {
folders: folders
}, function (view) {
}, (view) => {
this.notify(false);
view.render();
this.listenToOnce(view, 'select', function (folder) {
this.listenToOnce(view, 'select', (folder) => {
view.close();
this.addFolder(folder);
}, this);
});
});
}.bind(this)).fail(function () {
})
.catch(() => {
Espo.Ui.error(this.translate('couldNotConnectToImap', 'messages', 'EmailAccount'));
xhr.errorIsHandled = true;
}.bind(this));
});
}
},

View File

@@ -43,7 +43,7 @@ define('views/personal-data/modals/personal-data', ['views/modal'], function (De
{
name: 'cancel',
label: 'Close'
}
},
];
this.headerText = this.getLanguage().translate('Personal Data');
@@ -54,7 +54,7 @@ define('views/personal-data/modals/personal-data', ['views/modal'], function (De
name: 'erase',
label: 'Erase',
style: 'danger',
disabled: true
disabled: true,
});
}
@@ -65,9 +65,10 @@ define('views/personal-data/modals/personal-data', ['views/modal'], function (De
this.createView('record', 'views/personal-data/record/record', {
el: this.getSelector() + ' .record',
model: this.model
}, function (view) {
this.listenTo(view, 'check', function (fieldList) {
}, (view) => {
this.listenTo(view, 'check', (fieldList) => {
this.fieldList = fieldList;
if (fieldList.length) {
this.enableButton('erase');
} else {
@@ -85,21 +86,22 @@ define('views/personal-data/modals/personal-data', ['views/modal'], function (De
this.confirm({
message: this.translate('erasePersonalDataConfirmation', 'messages'),
confirmText: this.translate('Erase')
}, function () {
}, () => {
this.disableButton('erase');
this.ajaxPostRequest('DataPrivacy/action/erase', {
fieldList: this.fieldList,
entityType: this.scope,
id: this.model.id
}).then(function () {
id: this.model.id,
}).then(() => {
Espo.Ui.success(this.translate('Done'));
this.trigger('erase');
}.bind(this)).fail(function () {
})
.catch(() => {
this.enableButton('erase');
}.bind(this));
}.bind(this));
}
});
});
},
});
});

View File

@@ -312,8 +312,7 @@ InstallScript.prototype.step5 = function() {
})
.fail(function(ajaxData){
})
});
})
$('.field-smtpAuth').find('input[type="checkbox"]').change( function(e){