mirror of
https://github.com/espocrm/espocrm.git
synced 2026-03-09 18:57:02 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
291721c1d0 | ||
|
|
d96301d544 | ||
|
|
54d9674055 | ||
|
|
4a5a07649a | ||
|
|
cfdb65fad8 |
@@ -38,7 +38,7 @@ define('views/email/list', 'views/list', function (Dep) {
|
||||
|
||||
folderScope: 'EmailFolder',
|
||||
|
||||
currentFolderId: null,
|
||||
selectedFolderId: null,
|
||||
|
||||
defaultFolderId: 'inbox',
|
||||
|
||||
@@ -169,6 +169,8 @@ define('views/email/list', 'views/list', function (Dep) {
|
||||
},
|
||||
|
||||
applyFolder: function () {
|
||||
this.collection.selectedFolderId = this.selectedFolderId;
|
||||
|
||||
if (!this.selectedFolderId) {
|
||||
this.collection.whereFunction = null;
|
||||
|
||||
|
||||
@@ -52,187 +52,202 @@ define('views/email/record/list', 'views/record/list', function (Dep) {
|
||||
this.addMassAction('markAsRead', false, true);
|
||||
this.addMassAction('moveToTrash', false, true);
|
||||
|
||||
this.listenTo(this.collection, 'moving-to-trash', function (id) {
|
||||
this.listenTo(this.collection, 'moving-to-trash', (id) => {
|
||||
var model = this.collection.get(id);
|
||||
|
||||
if (model) {
|
||||
model.set('inTrash', true);
|
||||
}
|
||||
|
||||
if (this.collection.data.folderId !== 'trash' && this.collection.data.folderId !== 'all') {
|
||||
if (this.collection.selectedFolderId !== 'trash' && this.collection.selectedFolderId !== 'all') {
|
||||
this.removeRecordFromList(id);
|
||||
}
|
||||
}, this);
|
||||
});
|
||||
|
||||
this.listenTo(this.collection, 'retrieving-from-trash', function (id) {
|
||||
this.listenTo(this.collection, 'retrieving-from-trash', (id) => {
|
||||
var model = this.collection.get(id);
|
||||
|
||||
if (model) {
|
||||
model.set('inTrash', false);
|
||||
}
|
||||
|
||||
if (this.collection.data.folderId === 'trash') {
|
||||
if (this.collection.selectedFolderId === 'trash') {
|
||||
this.removeRecordFromList(id);
|
||||
}
|
||||
}, this);
|
||||
});
|
||||
},
|
||||
|
||||
massActionMarkAsRead: function () {
|
||||
var ids = [];
|
||||
|
||||
for (var i in this.checkedList) {
|
||||
ids.push(this.checkedList[i]);
|
||||
}
|
||||
$.ajax({
|
||||
url: 'Email/action/markAsRead',
|
||||
type: 'POST',
|
||||
data: JSON.stringify({
|
||||
ids: ids
|
||||
})
|
||||
});
|
||||
|
||||
ids.forEach(function (id) {
|
||||
Espo.Ajax
|
||||
.postRequest('Email/action/markAsRead', {
|
||||
ids: ids,
|
||||
});
|
||||
|
||||
ids.forEach(id => {
|
||||
var model = this.collection.get(id);
|
||||
|
||||
if (model) {
|
||||
model.set('isRead', true);
|
||||
}
|
||||
}, this);
|
||||
});
|
||||
},
|
||||
|
||||
massActionMarkAsNotRead: function () {
|
||||
var ids = [];
|
||||
|
||||
for (var i in this.checkedList) {
|
||||
ids.push(this.checkedList[i]);
|
||||
}
|
||||
$.ajax({
|
||||
url: 'Email/action/markAsNotRead',
|
||||
type: 'POST',
|
||||
data: JSON.stringify({
|
||||
ids: ids
|
||||
})
|
||||
});
|
||||
|
||||
ids.forEach(function (id) {
|
||||
Espo.Ajax
|
||||
.postRequest('Email/action/markAsNotRead', {
|
||||
ids: ids,
|
||||
});
|
||||
|
||||
ids.forEach(id => {
|
||||
var model = this.collection.get(id);
|
||||
|
||||
if (model) {
|
||||
model.set('isRead', false);
|
||||
}
|
||||
}, this);
|
||||
});
|
||||
},
|
||||
|
||||
massActionMarkAsImportant: function () {
|
||||
var ids = [];
|
||||
|
||||
for (var i in this.checkedList) {
|
||||
ids.push(this.checkedList[i]);
|
||||
}
|
||||
$.ajax({
|
||||
url: 'Email/action/markAsImportant',
|
||||
type: 'POST',
|
||||
data: JSON.stringify({
|
||||
ids: ids
|
||||
})
|
||||
});
|
||||
ids.forEach(function (id) {
|
||||
|
||||
Espo.Ajax
|
||||
.postRequest('Email/action/markAsImportant', {
|
||||
ids: ids,
|
||||
});
|
||||
|
||||
ids.forEach(id => {
|
||||
var model = this.collection.get(id);
|
||||
|
||||
if (model) {
|
||||
model.set('isImportant', true);
|
||||
}
|
||||
}, this);
|
||||
});
|
||||
},
|
||||
|
||||
massActionMarkAsNotImportant: function () {
|
||||
var ids = [];
|
||||
|
||||
for (var i in this.checkedList) {
|
||||
ids.push(this.checkedList[i]);
|
||||
}
|
||||
$.ajax({
|
||||
url: 'Email/action/markAsNotImportant',
|
||||
type: 'POST',
|
||||
data: JSON.stringify({
|
||||
ids: ids
|
||||
})
|
||||
});
|
||||
ids.forEach(function (id) {
|
||||
|
||||
Espo.Ajax
|
||||
.postRequest('Email/action/markAsNotImportant', {
|
||||
ids: ids,
|
||||
});
|
||||
|
||||
ids.forEach(id => {
|
||||
var model = this.collection.get(id);
|
||||
|
||||
if (model) {
|
||||
model.set('isImportant', false);
|
||||
}
|
||||
}, this);
|
||||
});
|
||||
},
|
||||
|
||||
massActionMoveToTrash: function () {
|
||||
var ids = [];
|
||||
|
||||
for (var i in this.checkedList) {
|
||||
ids.push(this.checkedList[i]);
|
||||
}
|
||||
|
||||
this.ajaxPostRequest('Email/action/moveToTrash', {
|
||||
ids: ids
|
||||
}).then(function () {
|
||||
Espo.Ui.success(this.translate('Done'));
|
||||
}.bind(this));
|
||||
Espo.Ajax
|
||||
.postRequest('Email/action/moveToTrash', {
|
||||
ids: ids
|
||||
})
|
||||
.then(() => {
|
||||
Espo.Ui.success(this.translate('Done'));
|
||||
});
|
||||
|
||||
if (this.collection.data.folderId === 'trash') {
|
||||
if (this.collection.selectedFolderId === 'trash') {
|
||||
return;
|
||||
}
|
||||
|
||||
ids.forEach(function (id) {
|
||||
ids.forEach(id => {
|
||||
this.collection.trigger('moving-to-trash', id);
|
||||
}, this);
|
||||
});
|
||||
},
|
||||
|
||||
massActionRetrieveFromTrash: function () {
|
||||
var ids = [];
|
||||
|
||||
for (var i in this.checkedList) {
|
||||
ids.push(this.checkedList[i]);
|
||||
}
|
||||
|
||||
this.ajaxPostRequest('Email/action/retrieveFromTrash', {
|
||||
ids: ids
|
||||
}).then(function () {
|
||||
Espo.Ui.success(this.translate('Done'));
|
||||
}.bind(this));
|
||||
Espo.Ajax
|
||||
.postRequest('Email/action/retrieveFromTrash', {
|
||||
ids: ids
|
||||
})
|
||||
.then(() => {
|
||||
Espo.Ui.success(this.translate('Done'));
|
||||
});
|
||||
|
||||
if (this.collection.data.folderId !== 'trash') {
|
||||
if (this.collection.selectedFolderId !== 'trash') {
|
||||
return;
|
||||
}
|
||||
|
||||
ids.forEach(function (id) {
|
||||
ids.forEach(id => {
|
||||
this.collection.trigger('retrieving-from-trash', id);
|
||||
}, this);
|
||||
});
|
||||
},
|
||||
|
||||
massActionMoveToFolder: function () {
|
||||
var ids = [];
|
||||
|
||||
for (var i in this.checkedList) {
|
||||
ids.push(this.checkedList[i]);
|
||||
}
|
||||
|
||||
this.createView('dialog', 'views/email-folder/modals/select-folder', {}, function (view) {
|
||||
this.createView('dialog', 'views/email-folder/modals/select-folder', {}, view => {
|
||||
view.render();
|
||||
this.listenToOnce(view, 'select', function (folderId) {
|
||||
|
||||
this.listenToOnce(view, 'select', folderId => {
|
||||
this.clearView('dialog');
|
||||
this.ajaxPostRequest('Email/action/moveToFolder', {
|
||||
ids: ids,
|
||||
folderId: folderId
|
||||
}).then(function () {
|
||||
this.collection.fetch().then(function () {
|
||||
Espo.Ui.success(this.translate('Done'));
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
}, this);
|
||||
}, this);
|
||||
|
||||
Espo.Ajax
|
||||
.postRequest('Email/action/moveToFolder', {
|
||||
ids: ids,
|
||||
folderId: folderId,
|
||||
})
|
||||
.then(() => {
|
||||
this.collection.fetch().then(() => {
|
||||
Espo.Ui.success(this.translate('Done'));
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
actionMarkAsImportant: function (data) {
|
||||
data = data || {};
|
||||
|
||||
var id = data.id;
|
||||
$.ajax({
|
||||
url: 'Email/action/markAsImportant',
|
||||
type: 'POST',
|
||||
data: JSON.stringify({
|
||||
id: id
|
||||
})
|
||||
});
|
||||
|
||||
Espo.Ajax
|
||||
.postRequest('Email/action/markAsImportant', {
|
||||
id: id,
|
||||
});
|
||||
|
||||
var model = this.collection.get(id);
|
||||
|
||||
if (model) {
|
||||
model.set('isImportant', true);
|
||||
}
|
||||
@@ -240,72 +255,81 @@ define('views/email/record/list', 'views/record/list', function (Dep) {
|
||||
|
||||
actionMarkAsNotImportant: function (data) {
|
||||
data = data || {};
|
||||
var id = data.id;
|
||||
$.ajax({
|
||||
url: 'Email/action/markAsNotImportant',
|
||||
type: 'POST',
|
||||
data: JSON.stringify({
|
||||
id: id
|
||||
})
|
||||
});
|
||||
|
||||
var id = data.id;
|
||||
|
||||
Espo.Ajax
|
||||
.postRequest('Email/action/markAsNotImportant', {
|
||||
id: id,
|
||||
});
|
||||
|
||||
var model = this.collection.get(id);
|
||||
|
||||
if (model) {
|
||||
model.set('isImportant', false);
|
||||
}
|
||||
},
|
||||
|
||||
actionMarkAllAsRead: function () {
|
||||
$.ajax({
|
||||
url: 'Email/action/markAllAsRead',
|
||||
type: 'POST'
|
||||
});
|
||||
Espo.Ajax
|
||||
.postRequest('Email/action/markAllAsRead');
|
||||
|
||||
this.collection.forEach(function (model) {
|
||||
this.collection.forEach(model => {
|
||||
model.set('isRead', true);
|
||||
}, this);
|
||||
});
|
||||
|
||||
this.collection.trigger('all-marked-read');
|
||||
},
|
||||
|
||||
actionMoveToTrash: function (data) {
|
||||
var id = data.id;
|
||||
this.ajaxPostRequest('Email/action/moveToTrash', {
|
||||
id: id
|
||||
}).then(function () {
|
||||
Espo.Ui.warning(this.translate('Moved to Trash', 'labels', 'Email'));
|
||||
this.collection.trigger('moving-to-trash', id);
|
||||
}.bind(this));
|
||||
|
||||
Espo.Ajax
|
||||
.postRequest('Email/action/moveToTrash', {
|
||||
id: id
|
||||
})
|
||||
.then(() => {
|
||||
Espo.Ui.warning(this.translate('Moved to Trash', 'labels', 'Email'));
|
||||
|
||||
this.collection.trigger('moving-to-trash', id);
|
||||
});
|
||||
},
|
||||
|
||||
actionRetrieveFromTrash: function (data) {
|
||||
var id = data.id;
|
||||
this.ajaxPostRequest('Email/action/retrieveFromTrash', {
|
||||
id: id
|
||||
}).then(function () {
|
||||
Espo.Ui.warning(this.translate('Retrieved from Trash', 'labels', 'Email'));
|
||||
this.collection.trigger('retrieving-from-trash', id);
|
||||
}.bind(this));
|
||||
|
||||
Espo.Ajax
|
||||
.postRequest('Email/action/retrieveFromTrash', {
|
||||
id: id
|
||||
})
|
||||
.then(() => {
|
||||
Espo.Ui.warning(this.translate('Retrieved from Trash', 'labels', 'Email'));
|
||||
|
||||
this.collection.trigger('retrieving-from-trash', id);
|
||||
});
|
||||
},
|
||||
|
||||
actionMoveToFolder: function (data) {
|
||||
var id = data.id;
|
||||
|
||||
this.createView('dialog', 'views/email-folder/modals/select-folder', {}, function (view) {
|
||||
this.createView('dialog', 'views/email-folder/modals/select-folder', {}, view => {
|
||||
view.render();
|
||||
this.listenToOnce(view, 'select', function (folderId) {
|
||||
|
||||
this.listenToOnce(view, 'select', folderId => {
|
||||
this.clearView('dialog');
|
||||
this.ajaxPostRequest('Email/action/moveToFolder', {
|
||||
id: id,
|
||||
folderId: folderId
|
||||
}).then(function () {
|
||||
this.collection.fetch().then(function () {
|
||||
Espo.Ui.success(this.translate('Done'));
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
}, this);
|
||||
}, this);
|
||||
|
||||
Espo.Ajax
|
||||
.postRequest('Email/action/moveToFolder', {
|
||||
id: id,
|
||||
folderId: folderId
|
||||
})
|
||||
.then(() => {
|
||||
this.collection.fetch().then(() => {
|
||||
Espo.Ui.success(this.translate('Done'));
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
actionSend: function (data) {
|
||||
@@ -314,27 +338,30 @@ define('views/email/record/list', 'views/record/list', function (Dep) {
|
||||
this.confirm({
|
||||
message: this.translate('sendConfirm', 'messages', 'Email'),
|
||||
confirmText: this.translate('Send', 'labels', 'Email'),
|
||||
}).then(
|
||||
function () {
|
||||
var model = this.collection.get(id);
|
||||
if (!model) return;
|
||||
}).then(() => {
|
||||
var model = this.collection.get(id);
|
||||
|
||||
Espo.Ui.notify(this.translate('Sending...', 'labels', 'Email'));
|
||||
if (!model) {
|
||||
return;
|
||||
}
|
||||
|
||||
model.save({
|
||||
Espo.Ui.notify(this.translate('Sending...', 'labels', 'Email'));
|
||||
|
||||
model
|
||||
.save({
|
||||
status: 'Sending',
|
||||
}).then(
|
||||
function () {
|
||||
Espo.Ui.success(this.translate('emailSent', 'messages', 'Email'));
|
||||
if (this.collection.data.folderId === 'drafts') {
|
||||
this.removeRecordFromList(id);
|
||||
this.uncheckRecord(id, null, true);
|
||||
this.collection.trigger('draft-sent');
|
||||
}
|
||||
}.bind(this)
|
||||
);
|
||||
}.bind(this)
|
||||
);
|
||||
})
|
||||
.then(() => {
|
||||
Espo.Ui.success(this.translate('emailSent', 'messages', 'Email'));
|
||||
|
||||
if (this.collection.selectedFolderId === 'drafts') {
|
||||
this.removeRecordFromList(id);
|
||||
this.uncheckRecord(id, null, true);
|
||||
this.collection.trigger('draft-sent');
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
@@ -106,6 +106,8 @@ define('views/record/list', 'view', function (Dep) {
|
||||
|
||||
setupHandlerType: 'record/list',
|
||||
|
||||
checkboxesDisabled: false,
|
||||
|
||||
events: {
|
||||
'click a.link': function (e) {
|
||||
e.stopPropagation();
|
||||
@@ -492,6 +494,8 @@ define('views/record/list', 'view', function (Dep) {
|
||||
this.checkboxes = _.isUndefined(this.options.checkboxes) ? this.checkboxes : this.options.checkboxes;
|
||||
this.selectable = _.isUndefined(this.options.selectable) ? this.selectable : this.options.selectable;
|
||||
|
||||
this.checkboxesDisabled = this.options.checkboxes === false;
|
||||
|
||||
this.rowActionsView = _.isUndefined(this.options.rowActionsView) ?
|
||||
this.rowActionsView :
|
||||
this.options.rowActionsView;
|
||||
@@ -1182,6 +1186,10 @@ define('views/record/list', 'view', function (Dep) {
|
||||
if (allResult) {
|
||||
this.checkAllResultMassActionList[method](item);
|
||||
}
|
||||
|
||||
if (!this.checkboxesDisabled) {
|
||||
this.checkboxes = true;
|
||||
}
|
||||
},
|
||||
|
||||
removeAllResultMassAction: function (item) {
|
||||
|
||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "espocrm",
|
||||
"version": "7.0.5",
|
||||
"version": "7.0.6",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "espocrm",
|
||||
"version": "7.0.5",
|
||||
"version": "7.0.6",
|
||||
"description": "Open-source CRM.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
Reference in New Issue
Block a user