From: Vincent Vanwaelscappel Date: Fri, 21 Nov 2025 19:01:42 +0000 (+0100) Subject: #7822 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=6ca17ca7943d00ae923febd677b14aa343d04fe4;p=cubist_cms-back.git #7822 @1 --- diff --git a/src/public/bunchmultiple/bunchmultiple.js b/src/public/bunchmultiple/bunchmultiple.js index 28221b4..6ea14ec 100644 --- a/src/public/bunchmultiple/bunchmultiple.js +++ b/src/public/bunchmultiple/bunchmultiple.js @@ -175,7 +175,16 @@ $(hidden).val(jsonval); }, + // https://stackoverflow.com/a/55292366 + trimAny: function (str, chars) { + var start = 0, end = str.length; + while (start < end && chars.indexOf(str[start]) >= 0) ++start; + while (end > start && chars.indexOf(str[end - 1]) >= 0) --end; + return (start > 0 || end < str.length) ? str.substring(start, end) : str; + }, + updateLegends: function () { + let $this = this; const sizeLimit = 60; $('[data-legend]' + this.bmidselector).each(function () { var item = $(this).closest('.item'); @@ -190,12 +199,20 @@ // Select2 fields if ($(input).closest('.form-group').find('.select2-selection__rendered').length > 0) { res = $(input).closest('.form-group').find('.select2-selection__rendered').text(); + } else if ($(input).is('select[data-options]')) { + if ($(input).data('options')[res] !== undefined) { + res = $(input).data('options')[res]; + } } + if (res.length > sizeLimit && res.indexOf('