email draft ui improvements
This commit is contained in:
@@ -104,6 +104,7 @@
|
||||
"Move to Folder": "Move to Folder",
|
||||
"Filters": "Filters",
|
||||
"Folders": "Folders",
|
||||
"No Subject": "No Subject",
|
||||
"View Users": "View Users"
|
||||
},
|
||||
"messages": {
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/email-folder/list-side', 'view', function (Dep) {
|
||||
define('views/email-folder/list-side', 'view', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
@@ -62,6 +62,7 @@ Espo.define('views/email-folder/list-side', 'view', function (Dep) {
|
||||
this.loadNotReadCounts();
|
||||
|
||||
this.listenTo(this.emailCollection, 'sync', this.loadNotReadCounts);
|
||||
this.listenTo(this.emailCollection, 'folders-update', this.loadNotReadCounts);
|
||||
|
||||
this.listenTo(this.emailCollection, 'all-marked-read', function (m) {
|
||||
this.countsData = this.countsData || {};
|
||||
@@ -74,6 +75,11 @@ Espo.define('views/email-folder/list-side', 'view', function (Dep) {
|
||||
this.renderCounts();
|
||||
});
|
||||
|
||||
this.listenTo(this.emailCollection, 'draft-sent', function (m) {
|
||||
this.decreaseNotReadCount('drafts');
|
||||
this.renderCounts();
|
||||
});
|
||||
|
||||
this.listenTo(this.emailCollection, 'change:isRead', function (model) {
|
||||
if (this.countsIsBeingLoaded) return;
|
||||
this.manageCountsDataAfterModelChanged(model);
|
||||
@@ -190,8 +196,7 @@ Espo.define('views/email-folder/list-side', 'view', function (Dep) {
|
||||
}
|
||||
this.$el.find('li a.count[data-id="'+id+'"]').text(value);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -114,8 +114,6 @@ define('views/email/list', 'views/list', function (Dep) {
|
||||
collection.url = 'EmailFolder/action/listAll';
|
||||
collection.maxSize = 200;
|
||||
|
||||
collection.folderCollection = collection;
|
||||
|
||||
this.listenToOnce(collection, 'sync', function () {
|
||||
callback.call(this, collection);
|
||||
}, this);
|
||||
@@ -126,6 +124,7 @@ define('views/email/list', 'views/list', function (Dep) {
|
||||
loadFolders: function () {
|
||||
var xhr = null;
|
||||
this.getFolderCollection(function (collection) {
|
||||
|
||||
this.createView('folders', 'views/email-folder/list-side', {
|
||||
collection: collection,
|
||||
emailCollection: this.collection,
|
||||
@@ -142,7 +141,7 @@ define('views/email/list', 'views/list', function (Dep) {
|
||||
xhr.abort();
|
||||
}
|
||||
|
||||
this.notify('Please wait...');
|
||||
this.notify(this.translate('pleaseWait', 'messages'));
|
||||
xhr = this.collection.fetch({
|
||||
success: function () {
|
||||
this.notify(false);
|
||||
@@ -157,6 +156,7 @@ define('views/email/list', 'views/list', function (Dep) {
|
||||
this.updateLastUrl();
|
||||
}, this);
|
||||
}, this);
|
||||
|
||||
}, this);
|
||||
},
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/email/modals/detail', ['views/modals/detail', 'views/email/detail'], function (Dep, Detail) {
|
||||
define('views/email/modals/detail', ['views/modals/detail', 'views/email/detail'], function (Dep, Detail) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
@@ -36,8 +36,10 @@ Espo.define('views/email/modals/detail', ['views/modals/detail', 'views/email/de
|
||||
this.buttonList.unshift({
|
||||
'name': 'reply',
|
||||
'label': 'Reply',
|
||||
'style': 'danger'
|
||||
'style': 'danger',
|
||||
'hidden': this.model.get('status') === 'Draft',
|
||||
});
|
||||
|
||||
if (this.model) {
|
||||
this.listenToOnce(this.model, 'sync', function () {
|
||||
setTimeout(function () {
|
||||
@@ -48,9 +50,19 @@ Espo.define('views/email/modals/detail', ['views/modals/detail', 'views/email/de
|
||||
|
||||
},
|
||||
|
||||
controlRecordButtonsVisibility: function () {
|
||||
Dep.prototype.controlRecordButtonsVisibility.call(this);
|
||||
|
||||
if (this.model.get('status') === 'Draft' || !this.getAcl().check('Email', 'create')) {
|
||||
this.hideButton('reply');
|
||||
} else {
|
||||
this.showButton('reply');
|
||||
}
|
||||
},
|
||||
|
||||
actionReply: function (data, e) {
|
||||
Detail.prototype.actionReply.call(this, {}, e, this.getPreferences().get('emailReplyToAllByDefault'));
|
||||
}
|
||||
},
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/email/record/compose', ['views/record/edit', 'views/email/record/detail'], function (Dep, Detail) {
|
||||
define('views/email/record/compose', ['views/record/edit', 'views/email/record/detail'], function (Dep, Detail) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
@@ -200,6 +200,14 @@ Espo.define('views/email/record/compose', ['views/record/edit', 'views/email/rec
|
||||
var model = this.model;
|
||||
model.set('status', 'Draft');
|
||||
|
||||
var subjectView = this.getFieldView('subject');
|
||||
if (subjectView) {
|
||||
subjectView.fetchToModel();
|
||||
if (!model.get('name')) {
|
||||
model.set('name', this.translate('No Subject', 'labels', 'Email'));
|
||||
}
|
||||
}
|
||||
|
||||
this.save();
|
||||
},
|
||||
|
||||
@@ -222,7 +230,7 @@ Espo.define('views/email/record/compose', ['views/record/edit', 'views/email/rec
|
||||
html = html || '';
|
||||
var value = html.replace(/\n/g, '<br>');
|
||||
return value;
|
||||
}
|
||||
},
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -319,7 +319,7 @@ define('views/email/record/list', 'views/record/list', function (Dep) {
|
||||
var model = this.collection.get(id);
|
||||
if (!model) return;
|
||||
|
||||
Espo.Ui.notify(' ... ');
|
||||
Espo.Ui.notify(this.translate('Sending...', 'labels', 'Email'));
|
||||
|
||||
model.save({
|
||||
status: 'Sending',
|
||||
@@ -330,6 +330,7 @@ define('views/email/record/list', 'views/record/list', function (Dep) {
|
||||
this.removeRecordFromList(id);
|
||||
this.uncheckRecord(id, null, true);
|
||||
}
|
||||
this.collection.trigger('draft-sent');
|
||||
}.bind(this)
|
||||
);
|
||||
}.bind(this)
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/modals/compose-email', 'views/modals/edit', function (Dep) {
|
||||
define('views/modals/compose-email', 'views/modals/edit', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
@@ -132,7 +132,11 @@ Espo.define('views/modals/compose-email', 'views/modals/edit', function (Dep) {
|
||||
var afterSave = function () {
|
||||
this.enableButton('send');
|
||||
this.enableButton('saveDraft');
|
||||
Espo.Ui.success(this.translate('savedAsDraft', 'messages', 'Email'));
|
||||
Espo.Ui.success(this.translate('savedAsDraft', 'messages', 'Email'))
|
||||
|
||||
this.trigger('after:save', model);
|
||||
|
||||
this.$el.find('button[data-name="cancel"]').html(this.translate('Close'));
|
||||
}.bind(this);
|
||||
|
||||
editView.once('after:save', afterSave , this);
|
||||
@@ -145,8 +149,7 @@ Espo.define('views/modals/compose-email', 'views/modals/edit', function (Dep) {
|
||||
}, this);
|
||||
|
||||
editView.saveDraft();
|
||||
}
|
||||
},
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user