$(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');
// 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('<svg') === -1) {
res = res.substring(0, sizeLimit) + '...';
}
return res;
});
+ if ($(this).attr('data-legend-trim')) {
+ txt = $this.trimAny(txt, $(this).attr('data-legend-trim').split(''));
+ }
$(this).html(txt);
});
},
<i class="la la-sort" role="presentation" aria-hidden="true"></i>
</a>
@endif
- <span class="legendsize" data-legend="{{$field['edit_label']}}"
+ <span class="legendsize" data-legend-trim="{{$field['edit_label_trim']??''}}" data-legend="{{$field['edit_label']}}"
data-bmid="{!! $field['rand'] !!}"></span>
<a href="#" class="action edit" data-bmid="{!! $field['rand'] !!}">
<i class="la la-pencil" role="presentation" aria-hidden="true"></i>