From b406de55a2db90dbdb9c1bee8f3681bd72c71fe9 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 18 Jun 2024 18:47:08 +0000 Subject: [PATCH] Bug 7508: Collapsable items on items tab Since we recently updated the patron entry form in the staff interface to have more visibly-collapsible sections I thought there might be interest in picking up this old bug. The patch implements collapsible sections on the item detail page, allowing the user to hide sections by clicking the item barcode header. The patch includes relocation of some JS code from the authority and MARC editors into the global JS file. This is the code that helps jump the user to a certain scroll point on the page. To test, apply the patch and clear your browser cache. - In the staff interface, locate a bibliographic record with items and view the detail page. - Click the "Items" tab in the sidebar. - On the item detail page, each section should have an icon indicating that they are expanded. Hovering your mouse over the section heading should highlight the clickable area. - Test that each section collapses correctly and that the next section is moved into view. - Go to Cataloging -> New record. Test that the links to specific tags under the main tab bar still work to jump you to the correct part of the page. - Go to Authorities -> New authority and perform the same test. Sponsored-by: Athens County Public Libraries Signed-off-by: Brendan Lawlor Signed-off-by: David Nind Signed-off-by: Jonathan Druart --- .../en/modules/authorities/authorities.tt | 21 ------- .../prog/en/modules/catalogue/moredetail.tt | 59 ++++++++++++++++--- .../prog/en/modules/cataloguing/addbiblio.tt | 20 ------- .../intranet-tmpl/prog/js/staff-global.js | 20 +++++++ 4 files changed, 70 insertions(+), 50 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt index 1a617b61ec5..00a28b46740 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt @@ -178,27 +178,6 @@ $(".tag_anchors_" + tabid ).addClass("tab_selected").show(); } - /** - * Returns a roughly ideal position to scroll an element into view - * @param {string} target - The HTML id of the element to scroll into view - * @param {string} elemid - The HTML id of the element which might obscure - * the view of the target element e.g. a floating toolbar - * @return {number} - The y-coordinate to pass to window.scrollTo() - */ - function getScrollto( target, elemid ){ - var dest = $("#" + target ); - var yoffset = dest.offset(); - - if( elemid != "" ){ - var element = $("#" + elemid ); - var elem_height = element.outerHeight(); - } else { - elem_height = 0; - } - return yoffset.top - elem_height - 20; - } - - /** * check if z3950 mandatories are set or not */ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt index 0943da4f426..56b0f47951f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt @@ -15,11 +15,31 @@ [% END %] [% INCLUDE 'doc-head-close.inc' %] - +[% FILTER collapse %] + +[% END %] [% USE KohaDates %] @@ -112,6 +132,10 @@ [% END %] [% FOREACH ITEM_DAT IN ITEM_DATA %] +

+ + Barcode [% ITEM_DAT.barcode | html %] [% IF not_for_loan %][% not_for_loan_description | html %][% END %] +

[% SET not_for_loan = 0 %] [% IF ITEM_DAT.notforloan || ITEM_DAT.effective_itemtype.notforloan %] @@ -119,8 +143,6 @@ [% SET not_for_loan_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => item.notforloan ) %] [% END %]
-

Barcode [% ITEM_DAT.barcode | html %] [% IF not_for_loan %][% not_for_loan_description | html %][% END %]

-

Item information [% UNLESS ( ITEM_DAT.nomod ) %] @@ -553,8 +575,27 @@ [% Asset.js("js/modals/add_catalog_concern.js") | $raw %] [% END %] [% END %] [% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt index ff3fe9f8d86..0748c11ee72 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -212,26 +212,6 @@ $(".tag_anchors_" + tabid ).addClass("tab_selected").show(); } - /** - * Returns a roughly ideal position to scroll an element into view - * @param {string} target - The HTML id of the element to scroll into view - * @param {string} elemid - The HTML id of the element which might obscure - * the view of the target element e.g. a floating toolbar - * @return {number} - The y-coordinate to pass to window.scrollTo() - */ - function getScrollto( target, elemid ){ - var dest = $("#" + target ); - var yoffset = dest.offset(); - - if( elemid != "" ){ - var element = $("#" + elemid ); - var elem_height = element.outerHeight(); - } else { - elem_height = 0; - } - return yoffset.top - elem_height - 20; - } - function redirect(dest){ $("#redirect").attr("value",dest); return Check(); diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js index 864239293e2..226e5352eaa 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js @@ -966,3 +966,23 @@ function toggleBtnIcon(element, start, replacement) { }); }); } + +/** + * Returns a roughly ideal position to scroll an element into view + * @param {string} target - The HTML id of the element to scroll into view + * @param {string} elemid - The HTML id of the element which might obscure + * the view of the target element e.g. a floating toolbar + * @return {number} - The y-coordinate to pass to window.scrollTo() + */ +function getScrollto(target, elemid) { + var dest = $("#" + target); + var yoffset = dest.offset(); + + if (elemid != "") { + var element = $("#" + elemid); + var elem_height = element.outerHeight(); + } else { + elem_height = 0; + } + return yoffset.top - elem_height - 20; +} -- 2.39.5