From 809c7e622f6cbd8fd7f5d2e0f2fd8733bf9d46aa 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 --- .../en/modules/authorities/authorities.tt | 21 ------- .../prog/en/modules/catalogue/moredetail.tt | 56 +++++++++++++++++-- .../prog/en/modules/cataloguing/addbiblio.tt | 20 ------- .../intranet-tmpl/prog/js/staff-global.js | 20 +++++++ 4 files changed, 70 insertions(+), 47 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 48e0984df2..c164fc2f5c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt @@ -177,27 +177,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 2020f9fb9d..2796eab5e5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt @@ -15,7 +15,31 @@ [% t("Koha") | html %] [% END %] [% INCLUDE 'doc-head-close.inc' %] - +[% FILTER collapse %] + +[% END %] [% USE KohaDates %] @@ -108,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 %] @@ -115,9 +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 @@ -540,8 +565,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 799a26e6c8..25352f9675 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -211,26 +211,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 e76bf876f6..4024f50da7 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js @@ -911,3 +911,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