Skip to content

EspoCRM – Open Source CRM Application

Panel label fix

Yuriifb292ccd4553
diff --git a/client/src/views/record/panels-container.js b/client/src/views/record/panels-container.js
index a908f846cd..d2e8052b61 100644
--- a/client/src/views/record/panels-container.js
+++ b/client/src/views/record/panels-container.js
@@ -57,7 +57,7 @@ class PanelsContainerRecordView extends View {
* @property {boolean} [sticked] To stick to an upper panel.
* @property {number} [tabNumber] A tab number.
* @property {string} [aclScope] A scope to check access to.
- * @property {Espo.Utils~AccessDefs[]} [accessDataList] Access control defs.
+ * @property {import('util').AccessDefs[]} [accessDataList] Access control defs.
* @property {Record} [dynamicLogicVisible] Visibility rules.
* @property {Record} [dynamicLogicStyled] Style rules.
* @property {Record} [options] Options.
@@ -424,12 +424,10 @@ class PanelsContainerRecordView extends View {
if (view.titleHtml) {
p.titleHtml = view.titleHtml;
- }
- else {
+ } else {
if (p.label) {
p.title = this.translate(p.label, 'labels', this.scope);
- }
- else {
+ } else {
p.title = view.title;
}
}
diff --git a/client/src/views/record/panels/relationship.js b/client/src/views/record/panels/relationship.js
index 67e0d4cb90..481e53c7ee 100644
--- a/client/src/views/record/panels/relationship.js
+++ b/client/src/views/record/panels/relationship.js
@@ -442,16 +442,26 @@ class RelationshipPanelView extends BottomPanelView {
iconHtml = this.getHelper().getScopeColorIconHtml(this.entityType);
}
- this.titleHtml = this.title;
+ let titlePart;
if (this.defs.label) {
- this.titleHtml = iconHtml + this.translate(this.defs.label, 'labels', this.entityType);
+ titlePart = this.translate(this.defs.label, 'labels', this.entityType);
+
+ const parentEntityType = this.model?.entityType;
+
+ if (parentEntityType && this.getLanguage().has(this.defs.label, 'labels', parentEntityType)) {
+ titlePart = this.translate(this.defs.label, 'labels', parentEntityType);
+ }
} else {
- this.titleHtml = iconHtml + this.title;
+ titlePart = this.title;
}
+ this.titleHtml = iconHtml + this.getHelper().escapeString(titlePart);
+
if (this.filter && this.filter !== 'all') {
- this.titleHtml += ' · ' + this.translateFilter(this.filter);
+ const filterPart = this.getHelper().escapeString(this.translateFilter(this.filter));
+
+ this.titleHtml += ' · ' + filterPart;
}
}
diff --git a/client/src/views/stream/panel.js b/client/src/views/stream/panel.js
index d9a8183a8f..5dde1c8947 100644
--- a/client/src/views/stream/panel.js
+++ b/client/src/views/stream/panel.js
@@ -363,12 +363,14 @@ class PanelStreamView extends RelationshipPanelView {
}
setupTitle() {
- this.title = this.translate('Stream');
+ this.title = this.getHelper().escapeString(this.translate('Stream'));
- this.titleHtml = this.title;
+ this.titleHtml = this.title
if (this.filter && this.filter !== 'all') {
- this.titleHtml += ' · ' + this.translate(this.filter, 'filters', 'Note');
+ const filterPart = this.getHelper().escapeString(this.translate(this.filter, 'filters', 'Note'));
+
+ this.titleHtml += ' · ' + filterPart;
}
}