[Bug 43762] New: FilterSearchResultsByLoggedInBranch needs more information when hiding info
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43762 Bug ID: 43762 Summary: FilterSearchResultsByLoggedInBranch needs more information when hiding info Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Searching Assignee: koha-bugs@lists.koha-community.org Reporter: cbrannon@cdalibrary.org QA Contact: testopia@bugs.koha-community.org Target Milestone: --- FilterSearchResultsByLoggedInBranch, whether set to hide or show other library copies, needs to show: Local Copies / Other Copies / Available Available should ALWAYS show the same number, or should be configurable. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43762 --- Comment #1 from Christopher Brannon <cbrannon@cdalibrary.org> --- This is what I currently use instead of FilterSearchResultsByLoggedInBranch: // Enhance item locations in search results (10/8/26) if ($('#catalog_results').length) { $('.availability').each(function () { let $availability = $(this); let $allItems = $availability.find('li'); let $localItems = $allItems.filter('.' + currentLibrary.code); let $otherItems = $allItems.not('.' + currentLibrary.code); // Highlight local copies $localItems.css({ 'color': '#78A42F', 'font-weight': 'bold', 'background-color': '#f5fbe9', 'border-left': '4px solid #78A42F', 'padding-left': '6px' }); // CASE 1: Local copies exist AND other libraries have copies if ($localItems.length && $otherItems.length) { $otherItems.hide(); $('<div class="location-toggle">' + '<a href="#" class="btn btn-outline-secondary btn-sm toggle-locations" style="margin-top:8px; display:inline-block;">' + 'Show ' + $otherItems.length + ' copies at other libraries</a>' + '</div>') .insertAfter($availability) .on('click', 'a', function (e) { e.preventDefault(); $otherItems.toggle(); $(this).text( $otherItems.first().is(':visible') ? 'Hide other libraries' : 'Show ' + $otherItems.length + ' copies at other libraries' ); }); } // CASE 1A: Only local copies exist else if ($localItems.length) { // Nothing to hide and no toggle needed } // CASE 2: No local copies exist else { $allItems.hide(); $('<div class="location-toggle no-local">' + '<strong>No copies at ' + currentLibrary.name + '</strong><br>' + '<a href="#" class="btn btn-outline-secondary btn-sm toggle-locations" style="margin-top:8px; display:inline-block;">' + 'Show ' + $allItems.length + ' copies at other libraries</a>' + '</div>') .insertAfter($availability) .on('click', 'a', function (e) { e.preventDefault(); $allItems.toggle(); $(this).text( $allItems.first().is(':visible') ? 'Hide other libraries' : 'Show ' + $allItems.length + ' copies at other libraries' ); }); } }); // Add global button only if at least one toggle exists if ($('.toggle-locations').length) { $('<span id="toggle-all-locations-container" ' + 'style="float:right; margin-left:1em; margin-top:-35px; position:relative; z-index:1;">' + '<a href="#" id="toggle-all-locations" class="btn btn-primary btn-sm">' + 'Show all locations' + '</a>' + '</span>') .appendTo('#searchresults nav:first'); let allExpanded = false; $(document).on('click', '#toggle-all-locations', function (e) { e.preventDefault(); if (!allExpanded) { $('.toggle-locations').each(function () { if ($(this).text().startsWith('Show')) { $(this).trigger('click'); } }); $(this).text('Hide other locations'); allExpanded = true; } else { $('.toggle-locations').each(function () { if ($(this).text().startsWith('Hide')) { $(this).trigger('click'); } }); $(this).text('Show all locations'); allExpanded = false; } }); } } // END Enhance item locations in search results -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43762 --- Comment #2 from Christopher Brannon <cbrannon@cdalibrary.org> --- This jquery relies on this: // Get logged-in branch information - 7/8/26 const $loggedInInfo = $('#logged-in-info-full'); const currentLibrary = { name: $loggedInInfo.find('.logged-in-branch-name').text().trim(), code: $loggedInInfo.find('.logged-in-branch-code').text().trim() }; console.log('Current Library (use like currentLibrary.name):', currentLibrary); //END Get logged in branch name and code -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43762 --- Comment #3 from Christopher Brannon <cbrannon@cdalibrary.org> --- I made an adjustment and put the current jquery in the library at https://wiki.koha-community.org/wiki/JQuery_Library#Show_Local_Copy_Status_i... -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org