From 9cdf92d30302b6885df0e81ca522fb5ed78db0ee Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 16 Oct 2024 17:24:55 +0000 Subject: [PATCH] Bug 36320: Clicking Edit items from catalogue/detail.pl leads to 'Add item' screen This patch updates the catalog toolbar so that the "Edit items" choice under the "Edit" menu is replaced with a new option: "Manage items," which takes you to the top of the add/edit items page. The "New item" menu item has been modified to add the anchor so that the link jumps the user directly to add item form (past the existing items). The patch also adds a "Jump to add item form" link at the top of the add/edit items page. To test, apply the patch and search for a bibliographic record in the staff interface. - View the detail page for the record. - Click the "Edit" menu button in the toolbar. - You should see the new menu item, "Manage items." - Clicking the "Manage items" button should take you to the top of the add/edit items page in cataloging. - You should see a "Jump to add item form" limk under the page heading. - Clicking it should jump you to the "Add item" form. - Clicking the "New item" menu item from the bibliographic detail "New" menu should take you directly to the add item form, scrolling down past the existing items. Sponsored-by: Athens County Public Libraries Signed-off-by: Kristi Krueger Signed-off-by: Martin Renvoize --- .../intranet-tmpl/prog/en/includes/cat-toolbar.inc | 2 +- .../prog/en/modules/cataloguing/additem.tt | 1 + .../intranet-tmpl/prog/js/cataloging_additem.js | 13 +++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc index 4b99bbea279..36d924b9524 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc @@ -60,7 +60,7 @@ [% END %] [% IF CAN_user_editcatalogue_edit_items or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) %] -
  • Edit items
  • +
  • Manage items
  • [% END %] [% IF ( CAN_user_tools_items_batchmod ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt index ae6da078547..7d966bee25e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt @@ -77,6 +77,7 @@ [% END %]

    Items for [% biblio.title | html %] [% IF ( biblio.author ) %] by [% biblio.author | html %][% END %] (Record #[% biblio.biblionumber | html %])

    + Jump to add item form [% IF ( barcode_not_unique ) %]
    Error saving item: Barcode must be unique.
    [% END %] [% IF ( no_next_barcode ) %]
    Error saving items: Unable to automatically determine values for barcodes. No item has been inserted.
    [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js b/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js index c8a2189b834..d4f28bbf841 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js +++ b/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js @@ -138,6 +138,19 @@ $(document).ready(function(){ return $("#" + $(this).data("item") + "-delete-item-form").submit(); } }) ; + + /* On page load, check for location.hash in the page URL */ + /* If present the location hash will be used to scroll to the relevant anchor */ + var hash = location.hash; + var hashPieces = hash.split('?'); + if( hashPieces[0] !== "" ){ + $( hashPieces[0] )[0].scrollIntoView(); + } + + $("#newitem_jump").on("click", function(e){ + e.preventDefault(); + document.getElementById("additema").scrollIntoView(); + }); }); function CheckTemplateForm(f) { -- 2.47.0