From d7804bfa791706229cc7ee30bd7f5bd2af025cb3 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Tue, 27 Feb 2024 10:18:40 +0200 Subject: [PATCH] ref --- client/src/views/stream/note.js | 18 +++---- .../{ => record}/row-actions/default.js | 53 ++++++++++--------- 2 files changed, 33 insertions(+), 38 deletions(-) rename client/src/views/stream/{ => record}/row-actions/default.js (62%) diff --git a/client/src/views/stream/note.js b/client/src/views/stream/note.js index d1dcbb5939..abf694c876 100644 --- a/client/src/views/stream/note.js +++ b/client/src/views/stream/note.js @@ -50,21 +50,15 @@ class NoteStreamView extends View { */ messageData = null - /** - * @protected - */ + /** @protected */ isEditable = false - - /** - * @protected - */ + /** @protected */ isRemovable = false - - /** - * @protected - */ + /** @protected */ isSystemAvatar = false + rowActionsView = 'views/stream/record/row-actions/default' + data() { return { isUserStream: this.isUserStream, @@ -115,7 +109,7 @@ class NoteStreamView extends View { }; if (!this.options.noEdit && (this.isEditable || this.isRemovable)) { - this.createView('right', 'views/stream/row-actions/default', { + this.createView('right', this.rowActionsView, { selector: '.right-container', acl: this.options.acl, model: this.model, diff --git a/client/src/views/stream/row-actions/default.js b/client/src/views/stream/record/row-actions/default.js similarity index 62% rename from client/src/views/stream/row-actions/default.js rename to client/src/views/stream/record/row-actions/default.js index 6ecfd01467..34ea12880f 100644 --- a/client/src/views/stream/row-actions/default.js +++ b/client/src/views/stream/record/row-actions/default.js @@ -26,34 +26,35 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/stream/row-actions/default', ['views/record/row-actions/edit-and-remove'], function (Dep) { +import DefaultRowActionsView from 'views/record/row-actions/default'; - return Dep.extend({ +class StreamDefaultNoteRowActionsView extends DefaultRowActionsView { - getActionList: function () { - var list = []; + getActionList() { + const list = []; - if (this.options.acl.edit && this.options.isEditable) { - list.push({ - action: 'quickEdit', - label: 'Edit', - data: { - id: this.model.id, - }, - }); - } + if (this.options.acl.edit && this.options.isEditable) { + list.push({ + action: 'quickEdit', + label: 'Edit', + data: { + id: this.model.id, + }, + }); + } - if (this.options.acl.edit && this.options.isRemovable) { - list.push({ - action: 'quickRemove', - label: 'Remove', - data: { - id: this.model.id, - }, - }); - } + if (this.options.acl.edit && this.options.isRemovable) { + list.push({ + action: 'quickRemove', + label: 'Remove', + data: { + id: this.model.id, + }, + }); + } - return list; - }, - }); -}); + return list; + } +} + +export default StreamDefaultNoteRowActionsView;