feature: implements mid trimming long text; implements repo length truncation

This commit is contained in:
ievgenii vdovenko 2026-01-06 17:54:17 +01:00
parent 1906b1960f
commit e0b2043c71
21 changed files with 311 additions and 96 deletions

View file

@ -286,9 +286,17 @@
query.callback(data);
};
const truncateSelection = function(item) {
return truncateMiddle(item, 35);
}
const truncateResult = function(item) {
return truncateMiddle(item, 60);
}
var select2RefFileSwitcher = function (targetElement, loadUrl, initialData) {
var formatResult = function (result, container, query) {
return formatSelect2SelectionRefs(result);
return formatSelect2SelectionRefs(result, truncateResult);
};
var formatSelection = function (data, container) {
@ -299,7 +307,7 @@
tmpl = (commit_ref.raw_id || "").substr(0,8);
} else if (commit_ref.type === 'branch') {
tmpl = tmpl.concat('<i class="icon-branch"></i> ');
tmpl = tmpl.concat(escapeHtml(commit_ref.text));
tmpl = tmpl.concat(truncateSelection(escapeHtml(commit_ref.text)));
} else if (commit_ref.type === 'tag') {
tmpl = tmpl.concat('<i class="icon-tag"></i> ');
tmpl = tmpl.concat(escapeHtml(commit_ref.text));