Skip to content

EspoCRM – Open Source CRM Application

Link field text-record

Yuriia17fc1c2b294
diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/CampaignLogRecord.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/CampaignLogRecord.json
index 854aff578c..2e29782fff 100644
--- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/CampaignLogRecord.json
+++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/CampaignLogRecord.json
@@ -38,7 +38,8 @@
"createdBy": {
"type": "link",
"readOnly": true,
- "fieldManagerParamList": []
+ "fieldManagerParamList": [],
+ "view": "views/fields/user"
},
"campaign": {
"type": "link"
diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/DocumentFolder.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/DocumentFolder.json
index ec027ff93c..dc19866004 100644
--- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/DocumentFolder.json
+++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/DocumentFolder.json
@@ -25,12 +25,14 @@
"createdBy": {
"type": "link",
"readOnly": true,
- "fieldManagerParamList": []
+ "fieldManagerParamList": [],
+ "view": "views/fields/user"
},
"modifiedBy": {
"type": "link",
"readOnly": true,
- "fieldManagerParamList": []
+ "fieldManagerParamList": [],
+ "view": "views/fields/user"
},
"teams": {
"type": "linkMultiple",
diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/KnowledgeBaseArticle.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/KnowledgeBaseArticle.json
index deb1b31176..3fc329330d 100644
--- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/KnowledgeBaseArticle.json
+++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/KnowledgeBaseArticle.json
@@ -82,12 +82,14 @@
"createdBy": {
"type": "link",
"readOnly": true,
- "fieldManagerParamList": []
+ "fieldManagerParamList": [],
+ "view": "views/fields/user"
},
"modifiedBy": {
"type": "link",
"readOnly": true,
- "fieldManagerParamList": []
+ "fieldManagerParamList": [],
+ "view": "views/fields/user"
},
"assignedUser": {
"type": "link",
diff --git a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/KnowledgeBaseCategory.json b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/KnowledgeBaseCategory.json
index e22f8b0079..e415ed198e 100644
--- a/application/Espo/Modules/Crm/Resources/metadata/entityDefs/KnowledgeBaseCategory.json
+++ b/application/Espo/Modules/Crm/Resources/metadata/entityDefs/KnowledgeBaseCategory.json
@@ -25,12 +25,14 @@
"createdBy": {
"type": "link",
"readOnly": true,
- "fieldManagerParamList": []
+ "fieldManagerParamList": [],
+ "view": "views/fields/user"
},
"modifiedBy": {
"type": "link",
"readOnly": true,
- "fieldManagerParamList": []
+ "fieldManagerParamList": [],
+ "view": "views/fields/user"
},
"order": {
"type": "int",
diff --git a/application/Espo/Resources/layouts/ActionHistoryRecord/listForLastViewed.json b/application/Espo/Resources/layouts/ActionHistoryRecord/listForLastViewed.json
index 8374a098c7..d19a833fe4 100644
--- a/application/Espo/Resources/layouts/ActionHistoryRecord/listForLastViewed.json
+++ b/application/Espo/Resources/layouts/ActionHistoryRecord/listForLastViewed.json
@@ -7,7 +7,8 @@
},
{
"name": "target",
- "notSortable": true
+ "notSortable": true,
+ "view": "views/last-viewed/fields/target"
},
{
"name":"createdAt",
diff --git a/client/res/templates/fields/link-parent/detail.tpl b/client/res/templates/fields/link-parent/detail.tpl
index 889e9aed16..8d0553f3a1 100644
--- a/client/res/templates/fields/link-parent/detail.tpl
+++ b/client/res/templates/fields/link-parent/detail.tpl
@@ -1,4 +1,4 @@
-{{#if idValue}}{{#if iconHtml}}{{{iconHtml}}}{{/if}}<a href="#{{foreignScope}}/view/{{idValue}}" title="{{translate foreignScope category='scopeNames'}}">{{nameValue}}</a>
+{{#if idValue}}{{#if iconHtml}}{{{iconHtml}}}{{/if}}<a href="#{{foreignScope}}/view/{{idValue}}" title="{{translate foreignScope category='scopeNames'}}" class="{{#if linkClass}}{{linkClass}}{{/if}}">{{nameValue}}</a>
{{else}}
{{#if valueIsSet}}
{{#if displayEntityType}}{{translate typeValue category='scopeNames'}}
diff --git a/client/res/templates/fields/link-parent/list.tpl b/client/res/templates/fields/link-parent/list.tpl
index c8d26f9a2f..7b006d7e32 100644
--- a/client/res/templates/fields/link-parent/list.tpl
+++ b/client/res/templates/fields/link-parent/list.tpl
@@ -3,6 +3,6 @@
<a
href="#{{foreignScope}}/view/{{idValue}}"
title="{{nameValue}}"
- class="text-default"
+ class="{{#if linkClass}} {{linkClass}} {{/if}}"
>{{nameValue}}</a>
{{~/if}}
diff --git a/client/res/templates/fields/user-with-avatar/detail.tpl b/client/res/templates/fields/user-with-avatar/detail.tpl
index 3a07bebb98..fb6dc625a2 100644
--- a/client/res/templates/fields/user-with-avatar/detail.tpl
+++ b/client/res/templates/fields/user-with-avatar/detail.tpl
@@ -1,5 +1,5 @@
{{#if idValue}}
-{{{avatar}}}<a href="#{{foreignScope}}/view/{{idValue}}" class="text-default">{{nameValue}}</a>
+{{{avatar}}}<a href="#{{foreignScope}}/view/{{idValue}}" class="{{#if linkClass}}{{linkClass}}{{/if}}">{{nameValue}}</a>
{{else}}
<span class="none-value">{{translate 'None'}}</span>
{{/if}}
diff --git a/client/res/templates/global-search/name-field.tpl b/client/res/templates/global-search/name-field.tpl
index b9f01b6e5e..11865a6f94 100644
--- a/client/res/templates/global-search/name-field.tpl
+++ b/client/res/templates/global-search/name-field.tpl
@@ -1 +1 @@
-{{{iconHtml}}}<a href="#{{scope}}/view/{{id}}">{{name}}</a>
+{{{iconHtml}}}<a href="#{{scope}}/view/{{id}}" class="text-record">{{name}}</a>
diff --git a/client/res/templates/notification/items/email-received.tpl b/client/res/templates/notification/items/email-received.tpl
index 3df73cff68..52f3d657b2 100644
--- a/client/res/templates/notification/items/email-received.tpl
+++ b/client/res/templates/notification/items/email-received.tpl
@@ -19,6 +19,7 @@
href="#Email/view/{{emailId}}"
data-id="{{emailId}}"
data-scope="Email"
+ class="text-record"
>{{emailName}}</a></span>
</div>
diff --git a/client/res/templates/stream/notes/email-received.tpl b/client/res/templates/stream/notes/email-received.tpl
index 15f4f93e72..ae120b37d3 100644
--- a/client/res/templates/stream/notes/email-received.tpl
+++ b/client/res/templates/stream/notes/email-received.tpl
@@ -32,6 +32,7 @@
href="#Email/view/{{emailId}}"
data-id="{{emailId}}"
data-scope="Email"
+ class="text-record"
>{{emailName}}</a></span>
</div>
diff --git a/client/src/views/email/fields/email-address-varchar.js b/client/src/views/email/fields/email-address-varchar.js
index 8a8fb445c9..367a8eefa2 100644
--- a/client/src/views/email/fields/email-address-varchar.js
+++ b/client/src/views/email/fields/email-address-varchar.js
@@ -610,6 +610,8 @@ class EmailAddressVarcharFieldView extends BaseFieldView {
avatarHtml = this.getHelper().getAvatarHtml(id, 'small', 18, 'avatar-link');
}
+ const className = this.mode === this.MODE_LIST ? 'text-default' : 'text-record';
+
return $('<div class="email-address-detail-item">')
.append(
avatarHtml,
@@ -617,6 +619,7 @@ class EmailAddressVarcharFieldView extends BaseFieldView {
.attr('href', `#${entityType}/view/${id}`)
.attr('data-scope', entityType)
.attr('data-id', id)
+ .addClass(className)
.text(name),
' <span class="text-muted middle-dot"></span> ',
$('<span>').text(address)
diff --git a/client/src/views/email/fields/from-address-varchar.js b/client/src/views/email/fields/from-address-varchar.js
index f86c38559f..9298d51ff5 100644
--- a/client/src/views/email/fields/from-address-varchar.js
+++ b/client/src/views/email/fields/from-address-varchar.js
@@ -205,7 +205,7 @@ class EmailFromAddressVarchar extends BaseFieldView {
}
const title = this.mode === this.MODE_LIST ? name : null;
- const className = this.mode === this.MODE_LIST ? 'text-default' : null;
+ const className = this.mode === this.MODE_LIST ? 'text-default' : 'text-record';
const $item = $('<div class="email-address-detail-item">')
.append(
diff --git a/client/src/views/fields/assigned-users.js b/client/src/views/fields/assigned-users.js
index 4266d0bd86..74b7adf836 100644
--- a/client/src/views/fields/assigned-users.js
+++ b/client/src/views/fields/assigned-users.js
@@ -30,8 +30,6 @@ import LinkMultipleFieldView from 'views/fields/link-multiple';
class AssignedUsersFieldView extends LinkMultipleFieldView {
- linkClass = 'text-default'
-
init() {
this.assignmentPermission = this.getAcl().getPermissionLevel('assignmentPermission');
diff --git a/client/src/views/fields/collaborators.js b/client/src/views/fields/collaborators.js
index 118edbfcea..d2c2fce9ab 100644
--- a/client/src/views/fields/collaborators.js
+++ b/client/src/views/fields/collaborators.js
@@ -30,8 +30,6 @@ import LinkMultipleFieldView from 'views/fields/link-multiple';
export default class CollaboratorsFieldView extends LinkMultipleFieldView {
- linkClass = 'text-default'
-
init() {
this.assignmentPermission = this.getAcl().getPermissionLevel('assignmentPermission');
diff --git a/client/src/views/fields/complex-created.js b/client/src/views/fields/complex-created.js
index ff6b887347..6667498f41 100644
--- a/client/src/views/fields/complex-created.js
+++ b/client/src/views/fields/complex-created.js
@@ -93,6 +93,7 @@ class ComplexCreatedFieldView extends BaseFieldView {
readOnly: true,
readOnlyLocked: true,
selector: '[data-name="' + field + '"]',
+ isInComplexField: true,
});
}
diff --git a/client/src/views/fields/link-multiple-with-columns.js b/client/src/views/fields/link-multiple-with-columns.js
index 0bc22507a7..2e754c6cee 100644
--- a/client/src/views/fields/link-multiple-with-columns.js
+++ b/client/src/views/fields/link-multiple-with-columns.js
@@ -162,6 +162,8 @@ class LinkMultipleWithColumnsFieldView extends LinkMultipleFieldView {
if (this.mode === this.MODE_LIST) {
$a.addClass('text-default');
+ } else {
+ $a.addClass(this.linkClass ?? 'text-record');
}
const $el = $('<div>').append($a);
diff --git a/client/src/views/fields/link-multiple-with-role.js b/client/src/views/fields/link-multiple-with-role.js
index 01b34bb9de..47c7ebcf77 100644
--- a/client/src/views/fields/link-multiple-with-role.js
+++ b/client/src/views/fields/link-multiple-with-role.js
@@ -134,13 +134,19 @@ class LinkMultipleWithRoleFieldView extends LinkMultipleFieldView {
role = '';
}
+ const $a = $('<a>')
+ .attr('href', `#${this.foreignScope}/view/${id}`)
+ .attr('data-id', id)
+ .text(name);
+
+ if (this.mode === this.MODE_LIST) {
+ $a.addClass('text-default');
+ } else {
+ $a.addClass(this.linkClass ?? 'text-record');
+ }
+
const $el = $('<div>')
- .append(
- $('<a>')
- .attr('href', '#' + this.foreignScope + '/view/' + id)
- .attr('data-id', id)
- .text(name)
- );
+ .append($a);
if (this.isDetailMode()) {
const iconHtml = this.getIconHtml(id);
diff --git a/client/src/views/fields/link-multiple.ts b/client/src/views/fields/link-multiple.ts
index da026f92d7..841201ce52 100644
--- a/client/src/views/fields/link-multiple.ts
+++ b/client/src/views/fields/link-multiple.ts
@@ -758,8 +758,8 @@ class LinkMultipleFieldView<
if (this.mode === this.MODE_LIST) {
$a.addClass('text-default');
- } else if (this.linkClass) {
- $a.addClass(this.linkClass);
+ } else {
+ $a.addClass(this.linkClass ?? 'text-record');
}
if (iconHtml) {
diff --git a/client/src/views/fields/link-parent.ts b/client/src/views/fields/link-parent.ts
index 0c4b15f742..67465dcc74 100644
--- a/client/src/views/fields/link-parent.ts
+++ b/client/src/views/fields/link-parent.ts
@@ -179,7 +179,7 @@ class LinkParentFieldView<
private $elementId: JQuery
private $elementType: JQuery
- protected data() {
+ protected data(): Record<string, any> {
let nameValue = this.model.get(this.nameName);
if (!nameValue && this.model.get(this.idName) && this.model.get(this.typeName)) {
@@ -198,6 +198,14 @@ class LinkParentFieldView<
iconHtml = this.getHelper().getScopeColorIconHtml(this.foreignScope);
}
+ let linkClass = null;
+
+ if (this.isDetailMode()) {
+ linkClass = 'text-record';
+ } else if (this.isListMode()) {
+ linkClass = 'text-default';
+ }
+
return {
...super.data(),
idName: this.idName,
@@ -211,6 +219,7 @@ class LinkParentFieldView<
valueIsSet: this.model.has(this.idName) || this.model.has(this.typeName),
iconHtml: iconHtml,
displayEntityType: this.displayEntityType && this.model.get(this.typeName),
+ linkClass: linkClass,
};
}
diff --git a/client/src/views/fields/link.ts b/client/src/views/fields/link.ts
index df9f76c767..1396b295ff 100644
--- a/client/src/views/fields/link.ts
+++ b/client/src/views/fields/link.ts
@@ -241,6 +241,12 @@ class LinkFieldView<
const createButton = this.createButton && (!this.createDisabled || this.forceCreateButton);
+ let linkClass = this.linkClass;
+
+ if (!linkClass && this.isDetailMode()) {
+ linkClass = 'text-record';
+ }
+
return {
...super.data(),
idName: this.idName,
@@ -252,7 +258,7 @@ class LinkFieldView<
iconHtml: iconHtml,
url: this.getUrl(),
createButton: createButton,
- linkClass: this.linkClass,
+ linkClass: linkClass,
};
}
diff --git a/client/src/views/fields/user.js b/client/src/views/fields/user.js
index 7954c52e51..4e6c09168a 100644
--- a/client/src/views/fields/user.js
+++ b/client/src/views/fields/user.js
@@ -32,7 +32,15 @@ import Autocomplete from 'ui/autocomplete';
class UserFieldView extends LinkFieldView {
searchTemplate = 'fields/user/search'
- linkClass = 'text-default'
+
+ setup() {
+ super.setup();
+
+ // noinspection JSUnresolvedReference
+ if (this.options.isInComplexField) {
+ this.linkClass = 'text-default';
+ }
+ }
setupSearch() {
super.setupSearch();
diff --git a/client/src/views/last-viewed/fields/target.ts b/client/src/views/last-viewed/fields/target.ts
new file mode 100644
index 0000000000..804a086e51
--- /dev/null
+++ b/client/src/views/last-viewed/fields/target.ts
@@ -0,0 +1,40 @@
+/************************************************************************
+ * This file is part of EspoCRM.
+ *
+ * EspoCRM – Open Source CRM application.
+ * Copyright (C) 2014-2026 EspoCRM, Inc.
+ * Website: https://www.espocrm.com
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * The interactive user interfaces in modified source and object code versions
+ * of this program must display Appropriate Legal Notices, as required under
+ * Section 5 of the GNU Affero General Public License version 3.
+ *
+ * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
+ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
+ ************************************************************************/
+
+import LinkParentFieldView from 'views/fields/link-parent';
+
+
+export default class LastViewedTargetFieldView extends LinkParentFieldView {
+
+ protected data(): Record<string, any> {
+ return {
+ ...super.data(),
+ linkClass: 'text-record',
+ };
+ }
+}
diff --git a/frontend/less/espo/custom.less b/frontend/less/espo/custom.less
index 01588585f4..ddddbfe9e8 100644
--- a/frontend/less/espo/custom.less
+++ b/frontend/less/espo/custom.less
@@ -2259,6 +2259,17 @@ td > span.color-icon {
.message {
a {
+ &[data-scope] {
+ & {
+ color: var(--link-record-color);
+ }
+
+ &:hover,
+ &:focus {
+ color: var(--link-record-hover-color);
+ }
+ }
+
&[data-scope="User"] {
&,
&:hover,