[REF] web: move _archive function to BasicController
This commit is contained in:
@@ -238,6 +238,25 @@ var BasicController = AbstractController.extend(FieldManagerMixin, {
|
||||
return _super(dataPointID, changes, event);
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Archive the current selection
|
||||
*
|
||||
* @private
|
||||
* @param {string[]} ids
|
||||
* @param {boolean} archive
|
||||
* @returns {Promise}
|
||||
*/
|
||||
_archive: async function (ids, archive) {
|
||||
if (ids.length === 0) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
if (archive) {
|
||||
await this.model.actionArchive(ids, this.handle);
|
||||
} else {
|
||||
await this.model.actionUnarchive(ids, this.handle);
|
||||
}
|
||||
return this.update({}, {reload: false});
|
||||
},
|
||||
/**
|
||||
* When the user clicks on a 'action button', this function determines what
|
||||
* should happen.
|
||||
|
||||
@@ -305,30 +305,6 @@ var FormController = BasicController.extend({
|
||||
core.bus.trigger('DOM_updated');
|
||||
return result;
|
||||
},
|
||||
|
||||
/**
|
||||
* Archive the current selection
|
||||
*
|
||||
* @private
|
||||
* @param {string[]} ids
|
||||
* @param {boolean} archive
|
||||
* @returns {Promise}
|
||||
*/
|
||||
_archive: function (ids, archive) {
|
||||
if (ids.length === 0) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
if (archive) {
|
||||
return this.model
|
||||
.actionArchive(ids, this.handle)
|
||||
.then(this.update.bind(this, {}, {reload: false}));
|
||||
} else {
|
||||
return this.model
|
||||
.actionUnarchive(ids, this.handle)
|
||||
.then(this.update.bind(this, {}, {reload: false}));
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Assign on the buttons save and discard additionnal behavior to facilitate
|
||||
* the work of the users doing input only using the keyboard
|
||||
|
||||
@@ -234,28 +234,6 @@ var ListController = BasicController.extend({
|
||||
});
|
||||
}).then(this._enableButtons.bind(this)).guardedCatch(this._enableButtons.bind(this));
|
||||
},
|
||||
/**
|
||||
* Archive the current selection
|
||||
*
|
||||
* @private
|
||||
* @param {string[]} ids
|
||||
* @param {boolean} archive
|
||||
* @returns {Promise}
|
||||
*/
|
||||
_archive: function (ids, archive) {
|
||||
if (ids.length === 0) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
if (archive) {
|
||||
return this.model
|
||||
.actionArchive(ids, this.handle)
|
||||
.then(this.update.bind(this, {}, {reload: false}));
|
||||
} else {
|
||||
return this.model
|
||||
.actionUnarchive(ids, this.handle)
|
||||
.then(this.update.bind(this, {}, {reload: false}));
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Assign on the buttons create additionnal behavior to facilitate the work of the users doing input only using the keyboard
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user