Bug 39189: Fix collapsing panels on moredetail.tt

This patch removes a duplicate togglePanel function and a duplicate
click handler from moredetail.tt. Bug 38227 made both global by adding
them to staff-global.js.

Also fixed: Converted a mistaken use of "__" to "_".

To test, apply the patch and clear your browser cache if necessary.

- Perform a catalog search and view the details of a title with multiple
  items.
- On the bibliographic detail page, click "Items" in the sidebar.
- Click a "Barcode XXXX" heading to confirm that it collapses and
  expands that section correctly.
- Collapse all sections and then test the barcode links in the sidebar.
  Clicking any of them should expand the correct panel and scroll to
  that section.
- Test the other pages using the togglePanel function: Patron entry and
  the authority search from triggered from the MARC editor.

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Owen Leonard 2025-02-24 12:35:44 +00:00 committed by Katrin Fischer
parent 713a23bb0a
commit cc418bb101
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
2 changed files with 2 additions and 19 deletions

View File

@ -587,12 +587,6 @@
$(document).ready(function(){
var browser = KOHA.browser('[% searchid | html %]', parseInt('[% biblionumber | html %]', 10));
browser.show();
$(".collapsed, .expanded").on("click",function(e){
e.preventDefault();
var linkid = this.id;
window.scrollTo( 0, getScrollto( linkid, "" ) );
togglePanel( $(this) );
});
$(".item_sublink").on("click", function () {
/* If the user clicks a sub-menu link in the sidebar,
@ -604,23 +598,12 @@
$("#" + href)
.addClass("expanded")
.removeClass("collapsed")
.attr("title", __("Collapse this section"));
.attr("title", _("Collapse this section"));
panel.show();
}
});
});
function togglePanel( node ){
var panel = node.next( ".page-section" );
if(panel.is(":visible")){
node.addClass("collapsed").removeClass("expanded").attr("title", __("Click to expand this section") );
panel.hide();
} else {
node.addClass("expanded").removeClass("collapsed").attr("title", __("Click to collapse this section") );
panel.show();
}
}
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]

View File

@ -60,7 +60,7 @@ $.fn.selectTabByID = function (tabID) {
};
function togglePanel(node) {
var panel = node.nextAll();
var panel = node.next();
if (panel.is(":visible")) {
node.addClass("collapsed")
.removeClass("expanded")