diff --git a/client/src/views/fields/attachment-multiple.js b/client/src/views/fields/attachment-multiple.js index e3b87220e4..dbd9d89092 100644 --- a/client/src/views/fields/attachment-multiple.js +++ b/client/src/views/fields/attachment-multiple.js @@ -80,8 +80,11 @@ class AttachmentMultipleFieldView extends BaseFieldView { idsName nameHash foreignScope - showPreviews = true accept = null + /** @protected */ + showPreviews = true + /** @protected */ + showPreviewsInListMode = false /** * @inheritDoc diff --git a/client/src/views/stream/fields/attachment-multiple.js b/client/src/views/stream/fields/attachment-multiple.js index 75746386d5..beaf985ef0 100644 --- a/client/src/views/stream/fields/attachment-multiple.js +++ b/client/src/views/stream/fields/attachment-multiple.js @@ -26,12 +26,11 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/stream/fields/attachment-multiple', ['views/fields/attachment-multiple'], function (Dep) { +import AttachmentMultipleFieldView from 'views/fields/attachment-multiple'; - return Dep.extend({ +export default class extends AttachmentMultipleFieldView { - showPreviews: true, + showPreviews = true + showPreviewsInListMode = true +} - showPreviewsInListMode: true, - }); -}); diff --git a/client/src/views/stream/fields/post.js b/client/src/views/stream/fields/post.js index 7d78a2b556..62381802c7 100644 --- a/client/src/views/stream/fields/post.js +++ b/client/src/views/stream/fields/post.js @@ -26,29 +26,29 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/stream/fields/post', ['views/fields/text'], function (Dep) { +import TextFieldView from 'views/fields/text'; - return Dep.extend({ +export default class StreamPostFieldView extends TextFieldView { - getValueForDisplay: function () { - let text = Dep.prototype.getValueForDisplay.call(this); + getValueForDisplay() { + let text = super.getValueForDisplay(); - if (this.isDetailMode() || this.isListMode()) { - let mentionData = (this.model.get('data') || {}).mentions || {}; + if (this.isDetailMode() || this.isListMode()) { + /** @type {Record} */ + const data = this.model.get('data') || {}; - Object - .keys(mentionData) - .sort((a, b) => { - return a.length < b.length; - }) - .forEach(item => { - var part = '[' + mentionData[item].name + '](#User/view/'+mentionData[item].id + ')'; + /** @type {Record} */ + const mentionData = data.mentions || {}; - text = text.replace(new RegExp(item, 'g'), part); - }); - } + Object.keys(mentionData) + .sort((a, b) => b.length - a.length) + .forEach(item => { + const part = `[${mentionData[item].name}](#User/view/${mentionData[item].id})`; - return text; - }, - }); -}); + text = text.replace(new RegExp(item, 'g'), part); + }); + } + + return text; + } +} diff --git a/client/src/views/stream/message.js b/client/src/views/stream/message.js index 644a034368..086e210c8b 100644 --- a/client/src/views/stream/message.js +++ b/client/src/views/stream/message.js @@ -36,12 +36,12 @@ class MessageStreamView extends View { setup() { let template = this.options.messageTemplate; - let data = Espo.Utils.clone(this.options.messageData || {}); + const data = Espo.Utils.clone(this.options.messageData || {}); this.dataForTemplate = {}; for (let key in data) { - let value = data[key] || ''; + const value = data[key] || ''; if (key.indexOf('html:') === 0) { key = key.substring(5); @@ -70,10 +70,10 @@ class MessageStreamView extends View { } if (value.indexOf('field:') === 0) { - let field = value.substring(6); + const field = value.substring(6); this.createField(key, field); - let keyEscaped = this.getHelper().escapeString(key); + const keyEscaped = this.getHelper().escapeString(key); template = template.replace( '{' + key + '}', @@ -84,7 +84,7 @@ class MessageStreamView extends View { } this.dataForTemplate[key] = value; - template = template.replace('{' + key + '}', '{{' + key + '}}'); + template = template.replace(`{${key}}`, `{{${key}}}`); } this.templateContent = template;