message ref
This commit is contained in:
@@ -42,11 +42,10 @@ define('views/notification/items/assign', ['views/notification/items/base'], fun
|
||||
this.messageData['entityType'] = Espo.Utils
|
||||
.upperCaseFirst((this.translate(data.entityType, 'scopeNames') || '').toLowerCase());
|
||||
|
||||
this.messageData['html:entity'] =
|
||||
this.messageData['entity'] =
|
||||
$('<a>')
|
||||
.attr('href', '#' + data.entityType + '/view/' + data.entityId)
|
||||
.text(data.entityName)
|
||||
.get(0).outerHTML;
|
||||
.text(data.entityName);
|
||||
|
||||
this.createMessage();
|
||||
},
|
||||
|
||||
@@ -50,26 +50,21 @@ define('views/notification/items/email-received', ['views/notification/items/bas
|
||||
Espo.Utils.upperCaseFirst((this.translate(data.entityType, 'scopeNames') || '').toLowerCase());
|
||||
|
||||
if (data.personEntityId) {
|
||||
this.messageData['html:from'] =
|
||||
this.messageData['from'] =
|
||||
$('<a>')
|
||||
.attr('href', '#' + data.personEntityType + '/view/' + data.personEntityId)
|
||||
.text(data.personEntityName)
|
||||
.get(0).outerHTML;
|
||||
.text(data.personEntityName);
|
||||
}
|
||||
else {
|
||||
let text = data.fromString || this.translate('empty address');
|
||||
|
||||
this.messageData['html:from'] =
|
||||
$('<span>')
|
||||
.text(text)
|
||||
.get(0).outerHTML;
|
||||
this.messageData['from'] = $('<span>').text(text);
|
||||
}
|
||||
|
||||
this.emailId = data.emailId;
|
||||
this.emailName = data.emailName;
|
||||
|
||||
this.createMessage();
|
||||
}
|
||||
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -42,17 +42,15 @@ define('views/notification/items/entity-removed', ['views/notification/items/bas
|
||||
this.messageData['entityType'] =
|
||||
Espo.Utils.upperCaseFirst((this.translate(data.entityType, 'scopeNames') || '').toLowerCase())
|
||||
|
||||
this.messageData['html:user'] =
|
||||
this.messageData['user'] =
|
||||
$('<a>')
|
||||
.attr('href', '#User/view/' + data.userId)
|
||||
.text(data.userName)
|
||||
.get(0).outerHTML;
|
||||
.text(data.userName);
|
||||
|
||||
this.messageData['html:entity'] =
|
||||
this.messageData['entity'] =
|
||||
$('<a>')
|
||||
.attr('href', '#' + data.entityType + '/view/' + data.entityId)
|
||||
.text(data.entityName)
|
||||
.get(0).outerHTML;
|
||||
.text(data.entityName);
|
||||
|
||||
this.createMessage();
|
||||
},
|
||||
|
||||
@@ -56,17 +56,15 @@ function (Dep, marked, DOMPurify) {
|
||||
this.messageData['entityType'] =
|
||||
Espo.Utils.upperCaseFirst((this.translate(data.entityType, 'scopeNames') || '').toLowerCase())
|
||||
|
||||
this.messageData['html:user'] =
|
||||
this.messageData['user'] =
|
||||
$('<a>')
|
||||
.attr('href', '#User/view/' + data.userId)
|
||||
.text(data.userName)
|
||||
.get(0).outerHTML;
|
||||
.text(data.userName);
|
||||
|
||||
this.messageData['html:entity'] =
|
||||
this.messageData['entity'] =
|
||||
$('<a>')
|
||||
.attr('href', '#' + data.entityType + '/view/' + data.entityId)
|
||||
.text(data.entityName)
|
||||
.get(0).outerHTML;
|
||||
.text(data.entityName);
|
||||
|
||||
this.createMessage();
|
||||
},
|
||||
|
||||
@@ -36,7 +36,7 @@ define('views/stream/message', ['view'], function (Dep) {
|
||||
|
||||
setup: function () {
|
||||
let template = this.options.messageTemplate;
|
||||
let data = this.options.messageData;
|
||||
let data = this.options.messageData || {};
|
||||
|
||||
this.dataForTemplate = {};
|
||||
|
||||
@@ -46,24 +46,39 @@ define('views/stream/message', ['view'], function (Dep) {
|
||||
if (key.indexOf('html:') === 0) {
|
||||
key = key.substring(5);
|
||||
this.dataForTemplate[key] = value;
|
||||
template = template.replace('{' + key + '}', '{{{' + key + '}}}');
|
||||
|
||||
template = template.replace('{' + key + '}', '{{{' + key +'}}}');
|
||||
continue;
|
||||
}
|
||||
|
||||
if (value instanceof jQuery) {
|
||||
this.dataForTemplate[key] = value.get(0).outerHTML;
|
||||
template = template.replace('{' + key + '}', '{{{' + key + '}}}');
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (value instanceof Element) {
|
||||
this.dataForTemplate[key] = value.outerHTML;
|
||||
template = template.replace('{' + key + '}', '{{{' + key + '}}}');
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!value.indexOf) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (value.indexOf('field:') === 0) {
|
||||
let field = value.substring(6);
|
||||
this.createField(key, field);
|
||||
|
||||
template = template.replace('{' + key + '}', '{{{' + key +'}}}');
|
||||
template = template.replace('{' + key + '}', '{{{' + key + '}}}');
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
this.dataForTemplate[key] = value;
|
||||
|
||||
template = template.replace('{' + key + '}', '{{' + key +'}}');
|
||||
template = template.replace('{' + key + '}', '{{' + key + '}}');
|
||||
}
|
||||
|
||||
this.templateContent = template;
|
||||
|
||||
@@ -48,10 +48,10 @@ define('views/stream/notes/assign', ['views/stream/note'], function (Dep) {
|
||||
this.assignedUserId = data.assignedUserId || null;
|
||||
this.assignedUserName = data.assignedUserName || null;
|
||||
|
||||
this.messageData['html:assignee'] = $('<a>')
|
||||
.attr('href', '#User/view/' + data.assignedUserId)
|
||||
.text(data.assignedUserName)
|
||||
.get(0).outerHTML;
|
||||
this.messageData['assignee'] =
|
||||
$('<a>')
|
||||
.attr('href', '#User/view/' + data.assignedUserId)
|
||||
.text(data.assignedUserName);
|
||||
|
||||
if (this.isUserStream) {
|
||||
if (this.assignedUserId) {
|
||||
|
||||
@@ -58,12 +58,10 @@ define('views/stream/notes/create-related', ['views/stream/note'], function (Dep
|
||||
|
||||
this.messageData['relatedEntityType'] = this.translateEntityType(this.entityType);
|
||||
|
||||
this.messageData['html:relatedEntity'] =
|
||||
this.messageData['relatedEntity'] =
|
||||
$('<a>')
|
||||
.attr('href', '#' + this.entityType + '/view/' + this.entityId)
|
||||
.text(this.entityName)
|
||||
.get(0).outerHTML;
|
||||
|
||||
.text(this.entityName);
|
||||
|
||||
this.createMessage();
|
||||
},
|
||||
|
||||
@@ -52,10 +52,10 @@ define('views/stream/notes/create', ['views/stream/note'], function (Dep) {
|
||||
this.assignedUserId = data.assignedUserId || null;
|
||||
this.assignedUserName = data.assignedUserName || null;
|
||||
|
||||
this.messageData['html:assignee'] = $('<a>')
|
||||
.attr('href', '#User/view/' + this.assignedUserId)
|
||||
.text(this.assignedUserName)
|
||||
.get(0).outerHTML;
|
||||
this.messageData['assignee'] =
|
||||
$('<a>')
|
||||
.attr('href', '#User/view/' + this.assignedUserId)
|
||||
.text(this.assignedUserName);
|
||||
|
||||
let isYou = false;
|
||||
|
||||
|
||||
@@ -76,11 +76,10 @@ define('views/stream/notes/email-received', ['views/stream/note'], function (Dep
|
||||
}
|
||||
}
|
||||
|
||||
this.messageData['html:email'] =
|
||||
this.messageData['email'] =
|
||||
$('<a>')
|
||||
.attr('href', '#Email/view/' + data.emailId)
|
||||
.text(data.emailName)
|
||||
.get(0).outerHTML;
|
||||
.text(data.emailName);
|
||||
|
||||
this.messageName = 'emailReceived';
|
||||
|
||||
@@ -91,11 +90,10 @@ define('views/stream/notes/email-received', ['views/stream/note'], function (Dep
|
||||
if (data.personEntityId) {
|
||||
this.messageName += 'From';
|
||||
|
||||
this.messageData['html:from'] =
|
||||
this.messageData['from'] =
|
||||
$('<a>')
|
||||
.attr('href', '#' + data.personEntityType + '/view/' + data.personEntityId)
|
||||
.text(data.personEntityName)
|
||||
.get(0).outerHTML;
|
||||
.text(data.personEntityName);
|
||||
}
|
||||
|
||||
if (
|
||||
|
||||
@@ -68,19 +68,17 @@ define('views/stream/notes/email-sent', ['views/stream/note'], function (Dep) {
|
||||
}
|
||||
}
|
||||
|
||||
this.messageData['html:email'] =
|
||||
this.messageData['email'] =
|
||||
$('<a>')
|
||||
.attr('href', '#Email/view/' + data.emailId)
|
||||
.text(data.emailName)
|
||||
.get(0).outerHTML;
|
||||
.text(data.emailName);
|
||||
|
||||
this.messageName = 'emailSent';
|
||||
|
||||
this.messageData['html:by'] =
|
||||
this.messageData['by'] =
|
||||
$('<a>')
|
||||
.attr('href', '#' + data.personEntityType + '/view/' + data.personEntityId)
|
||||
.text(data.personEntityName)
|
||||
.get(0).outerHTML;
|
||||
.text(data.personEntityName);
|
||||
|
||||
if (this.isThis) {
|
||||
this.messageName += 'This';
|
||||
|
||||
@@ -57,14 +57,12 @@ define('views/stream/notes/relate', ['views/stream/note'], function (Dep) {
|
||||
|
||||
this.messageData['relatedEntityType'] = this.translateEntityType(this.entityType);
|
||||
|
||||
this.messageData['html:relatedEntity'] =
|
||||
this.messageData['relatedEntity'] =
|
||||
$('<a>')
|
||||
.attr('href', '#' + this.entityType + '/view/' + this.entityId)
|
||||
.text(this.entityName)
|
||||
.get(0).outerHTML;
|
||||
.text(this.entityName);
|
||||
|
||||
this.createMessage();
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user