mass retrive from trash
This commit is contained in:
@@ -99,6 +99,7 @@
|
||||
"markAsImportant": "Mark as Important",
|
||||
"markAsNotImportant": "Unmark Importance",
|
||||
"moveToTrash": "Move to Trash",
|
||||
"moveToFolder": "Move to Folder"
|
||||
"moveToFolder": "Move to Folder",
|
||||
"retrieveFromTrash": "Retrieve from Trash"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ Espo.define('views/email-folder/list-side', 'view', function (Dep) {
|
||||
this.manageModelRemoving(model);
|
||||
}, this);
|
||||
|
||||
this.listenTo(this.emailCollection, 'retrieving-to-trash', function (id) {
|
||||
this.listenTo(this.emailCollection, 'retrieving-from-trash', function (id) {
|
||||
var model = this.emailCollection.get(id);
|
||||
if (!model) return;
|
||||
if (this.countsIsBeingLoaded) return;
|
||||
|
||||
@@ -52,6 +52,7 @@ Espo.define('views/email/record/list', 'views/record/list', function (Dep) {
|
||||
this.massActionList.push('markAsImportant');
|
||||
this.massActionList.push('markAsNotImportant');
|
||||
this.massActionList.push('moveToFolder');
|
||||
this.massActionList.push('retrieveFromTrash');
|
||||
},
|
||||
|
||||
massActionMarkAsRead: function () {
|
||||
@@ -141,13 +142,16 @@ Espo.define('views/email/record/list', 'views/record/list', function (Dep) {
|
||||
for (var i in this.checkedList) {
|
||||
ids.push(this.checkedList[i]);
|
||||
}
|
||||
$.ajax({
|
||||
url: 'Email/action/moveToTrash',
|
||||
type: 'POST',
|
||||
data: JSON.stringify({
|
||||
ids: ids
|
||||
})
|
||||
});
|
||||
|
||||
this.ajaxPostRequest('Email/action/moveToTrash', {
|
||||
ids: ids
|
||||
}).then(function () {
|
||||
Espo.Ui.success(this.translate('Done'));
|
||||
}.bind(this));
|
||||
|
||||
if (this.collection.data.folderId === 'trash') {
|
||||
return;
|
||||
}
|
||||
|
||||
ids.forEach(function (id) {
|
||||
this.collection.trigger('moving-to-trash', id);
|
||||
@@ -155,6 +159,28 @@ Espo.define('views/email/record/list', 'views/record/list', function (Dep) {
|
||||
}, 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));
|
||||
|
||||
if (this.collection.data.folderId !== 'trash') {
|
||||
return;
|
||||
}
|
||||
|
||||
ids.forEach(function (id) {
|
||||
this.collection.trigger('retrieving-from-trash', id);
|
||||
this.removeRecordFromList(id);
|
||||
}, this);
|
||||
},
|
||||
|
||||
massActionMoveToFolder: function () {
|
||||
var ids = [];
|
||||
for (var i in this.checkedList) {
|
||||
@@ -242,7 +268,7 @@ Espo.define('views/email/record/list', 'views/record/list', function (Dep) {
|
||||
id: id
|
||||
}).then(function () {
|
||||
Espo.Ui.warning(this.translate('Retrieved from Trash', 'labels', 'Email'));
|
||||
this.collection.trigger('retrieving-to-trash', id);
|
||||
this.collection.trigger('retrieving-from-trash', id);
|
||||
this.removeRecordFromList(id);
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user