View | Details | Raw Unified | Return to bug 35908
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc (-2 / +2 lines)
Lines 513-519 Link Here
513
                                    if( !singleBranchMode && data == logged_in_library_id ) {
513
                                    if( !singleBranchMode && data == logged_in_library_id ) {
514
                                        return "<span class=\"currentlibrary\">" + escape_str(library_name) + "</span>";
514
                                        return "<span class=\"currentlibrary\">" + escape_str(library_name) + "</span>";
515
                                    } else {
515
                                    } else {
516
                                        return escape_str(library_name);
516
                                        return escape_str(truncateStringForDisplay(library_name));
517
                                    }
517
                                    }
518
                                }
518
                                }
519
                            }
519
                            }
Lines 523-529 Link Here
523
                                "searchable": true,
523
                                "searchable": true,
524
                                "orderable": true,
524
                                "orderable": true,
525
                                "render": function( data, type, row, meta ) {
525
                                "render": function( data, type, row, meta ) {
526
                                    return escape_str(categories_map[data.toLowerCase()].description);
526
                                    return escape_str(truncateStringForDisplay(categories_map[data.toLowerCase()].description));
527
                                }
527
                                }
528
                            }
528
                            }
529
                            [% CASE 'dateexpiry' %]
529
                            [% CASE 'dateexpiry' %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/datatables.js (-1 / +1 lines)
Lines 846-852 function _dt_add_filters(table_node, table_dt, filters_options = {}) { Link Here
846
                    filters_options[i] = filters_options[i]()
846
                    filters_options[i] = filters_options[i]()
847
                }
847
                }
848
                $(filters_options[i]).each(function(){
848
                $(filters_options[i]).each(function(){
849
                    let o = $('<option value="%s">%s</option>'.format(this._id, this._str));
849
                    let o = $('<option value="%s" title="%s">%s</option>'.format(this._id, this._str, truncateStringForDisplay(this._str)));
850
                    if ( existing_search === this._id ) {
850
                    if ( existing_search === this._id ) {
851
                        o.prop("selected", "selected");
851
                        o.prop("selected", "selected");
852
                    }
852
                    }
(-)a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js (-1 / +16 lines)
Lines 339-344 function playSound( sound ) { Link Here
339
    document.getElementById("audio-alert").innerHTML = '<audio src="' + sound + '" autoplay="autoplay" autobuffer="autobuffer"></audio>';
339
    document.getElementById("audio-alert").innerHTML = '<audio src="' + sound + '" autoplay="autoplay" autobuffer="autobuffer"></audio>';
340
}
340
}
341
341
342
/**
343
 * Truncates a given string to a specified number of characters while preserving whole words.
344
 *
345
 * @param {string} string - The input string to be truncated
346
 * @param {number} [chars=50] - The number of characters to truncate the string to
347
 * @return {string} The truncated string with whole words preserved
348
 */
349
function truncateStringForDisplay(string, chars=50) {
350
    if (chars >= string.length) return string;
351
    let truncated_str = string.substring(0, chars);
352
    let last_word_boundary = truncated_str.match(/\b/gi).pop();
353
    let last_word_boundary_index =
354
        truncated_str.lastIndexOf(last_word_boundary);
355
    return truncated_str.substring(0, last_word_boundary_index) + "...";
356
}
357
342
// For keeping the text when navigating the search tabs
358
// For keeping the text when navigating the search tabs
343
function keep_text(clicked_index) {
359
function keep_text(clicked_index) {
344
    var searchboxes = document.getElementsByClassName("head-searchbox");
360
    var searchboxes = document.getElementsByClassName("head-searchbox");
345
- 

Return to bug 35908