This commit is contained in:
Yuri Kuznetsov
2024-01-12 13:53:54 +02:00
parent f865338ad0
commit f52a3ba773
2 changed files with 25 additions and 25 deletions
+10 -10
View File
@@ -106,7 +106,7 @@ class EditStreamView extends BaseRecordView {
}
data() {
let data = super.data();
const data = super.data();
data.interactiveMode = this.options.interactiveMode;
@@ -123,7 +123,7 @@ class EditStreamView extends BaseRecordView {
this.enablePostingMode();
};
this.events['keydown textarea[data-name="post"]'] = (e) => {
this.addHandler('keydown', 'textarea[data-name="post"]', /** KeyboardEvent */e => {
if (Espo.Utils.getKeyFromKeyEvent(e) === 'Control+Enter') {
e.stopPropagation();
e.preventDefault();
@@ -139,20 +139,20 @@ class EditStreamView extends BaseRecordView {
this.disablePostingMode();
}
}*/
};
});
this.events['click button.post'] = () => {
this.post();
};
}
let optionList = ['self'];
const optionList = ['self'];
this.model.set('type', 'Post');
this.model.set('targetType', 'self');
let messagePermission = this.getAcl().getPermissionLevel('message');
let portalPermission = this.getAcl().getPermissionLevel('portal');
const messagePermission = this.getAcl().getPermissionLevel('message');
const portalPermission = this.getAcl().getPermissionLevel('portal');
if (messagePermission === 'team' || messagePermission === 'all') {
optionList.push('users');
@@ -209,7 +209,7 @@ class EditStreamView extends BaseRecordView {
this.$el.find('.post-control').removeClass('hidden');
if (!this.postingMode) {
let $body = $('body');
const $body = $('body');
$body.off('click.stream-create-post');
@@ -234,7 +234,7 @@ class EditStreamView extends BaseRecordView {
afterRender() {
this.$postButton = this.$el.find('button.post');
let postView = this.getFieldView('post');
const postView = this.getFieldView('post');
if (postView) {
this.stopListening(postView, 'add-files');
@@ -242,7 +242,7 @@ class EditStreamView extends BaseRecordView {
this.listenTo(postView, 'add-files', (files) => {
this.enablePostingMode();
let attachmentsView = /** @type module:views/fields/attachment-multiple */
const attachmentsView = /** @type module:views/fields/attachment-multiple */
this.getFieldView('attachments');
if (!attachmentsView) {
@@ -257,7 +257,7 @@ class EditStreamView extends BaseRecordView {
validate() {
let notValid = super.validate();
let message = this.model.get('post') || '';
const message = this.model.get('post') || '';
if (message.trim() === '' && !(this.model.get('attachmentsIds') || []).length) {
notValid = true;
+15 -15
View File
@@ -59,7 +59,7 @@ class ListStreamRecordView extends ListExpandedRecordView {
return;
}
let lengthBeforeFetch = options.lengthBeforeFetch || 0;
const lengthBeforeFetch = options.lengthBeforeFetch || 0;
if (lengthBeforeFetch === 0) {
this.buildRows(() => this.reRender());
@@ -67,9 +67,9 @@ class ListStreamRecordView extends ListExpandedRecordView {
return;
}
let $list = this.$el.find(this.listContainerEl);
const $list = this.$el.find(this.listContainerEl);
let rowCount = this.collection.length - lengthBeforeFetch;
const rowCount = this.collection.length - lengthBeforeFetch;
if (rowCount === 0) {
return;
@@ -78,7 +78,7 @@ class ListStreamRecordView extends ListExpandedRecordView {
this.isRenderingNew = true;
for (let i = rowCount - 1; i >= 0; i--) {
let model = this.collection.at(i);
const model = this.collection.at(i);
this.buildRow(i, model, view => {
if (i === 0) {
@@ -88,7 +88,7 @@ class ListStreamRecordView extends ListExpandedRecordView {
let $row = $(this.getRowContainerHtml(model.id));
// Prevent a race condition issue.
let $existingRow = this.$el.find(`[data-id="${model.id}"]`);
const $existingRow = this.$el.find(`[data-id="${model.id}"]`);
if ($existingRow.length) {
$row = $existingRow;
@@ -104,16 +104,16 @@ class ListStreamRecordView extends ListExpandedRecordView {
});
this.events['auxclick a[href][data-scope][data-id]'] = e => {
let isCombination = e.button === 1 && (e.ctrlKey || e.metaKey);
const isCombination = e.button === 1 && (e.ctrlKey || e.metaKey);
if (!isCombination) {
return;
}
let $target = $(e.currentTarget);
const $target = $(e.currentTarget);
let id = $target.attr('data-id');
let scope = $target.attr('data-scope');
const id = $target.attr('data-id');
const scope = $target.attr('data-scope');
e.preventDefault();
e.stopPropagation();
@@ -126,12 +126,12 @@ class ListStreamRecordView extends ListExpandedRecordView {
}
buildRow(i, model, callback) {
let key = model.id;
const key = model.id;
this.rowList.push(key);
let type = model.get('type');
let viewName = this.itemViews[type] || 'views/stream/notes/' + Espo.Utils.camelCaseToHyphen(type);
const type = model.get('type');
const viewName = this.itemViews[type] || 'views/stream/notes/' + Espo.Utils.camelCaseToHyphen(type);
this.createView(key, viewName, {
model: model,
@@ -155,11 +155,11 @@ class ListStreamRecordView extends ListExpandedRecordView {
if (this.collection.length > 0) {
this.wait(true);
let count = this.collection.models.length;
const count = this.collection.models.length;
let built = 0;
for (let i in this.collection.models) {
let model = this.collection.models[i];
for (const i in this.collection.models) {
const model = this.collection.models[i];
this.buildRow(i, model, () => {
built++;