From dbfb1c696f47ee4ecf65b95c125066d6ab590df1 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Mon, 26 Feb 2024 11:21:53 +0200 Subject: [PATCH] role select style --- client/src/views/fields/link-multiple-with-role.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/client/src/views/fields/link-multiple-with-role.js b/client/src/views/fields/link-multiple-with-role.js index 2470ea83cb..1e99a20f63 100644 --- a/client/src/views/fields/link-multiple-with-role.js +++ b/client/src/views/fields/link-multiple-with-role.js @@ -94,6 +94,11 @@ class LinkMultipleWithRoleFieldView extends LinkMultipleFieldView { this.skipRoles = true; } } + + if (this.roleType === this.ROLE_TYPE_ENUM) { + this.styleMap = /** @type {Record}*/ this.getMetadata() + .get(['entityDefs', this.model.entityType, 'fields', this.roleField, 'style']) || {}; + } } getAttributeList() { @@ -136,8 +141,7 @@ class LinkMultipleWithRoleFieldView extends LinkMultipleFieldView { } if (role) { - let style = this.getMetadata() - .get(['entityDefs', this.model.entityType, 'fields', this.roleField, 'style', role]); + let style = this.styleMap[role]; let className = 'text'; @@ -242,6 +246,12 @@ class LinkMultipleWithRoleFieldView extends LinkMultipleFieldView { $option.attr('selected', 'selected'); } + const style = this.styleMap[role]; + + if (style) { + $option.addClass('text-' + style) + } + $role.append($option); });