From 73a541e19c535cc6629e9b6dbac7598f8d434db1 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 11 Oct 2021 18:09:27 +0000 Subject: [PATCH] Bug 28079: Set focus to search box field when adding an order to basket This patch modifies the "Add to basket" modal in acquisitions so that focus is automatically moved to the first form field when the modal appears. The patch also corrects the modal markup so that it's more consistent with default Bootstrap markup. To test, apply the patch and go to Acquisitions. - Search for a vendor and, if necessary, create a basket. - Click the "Add to basket" button. The modal which appears should have a header reading "Add order to basket " - The form field should have cursor focus. - View the basket and click the "Add to basket" button in the toolbar. - The modal shown should also be correct. Signed-off-by: David Nind Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart --- .../includes/acquisitions-add-to-basket.inc | 2 +- .../prog/en/modules/acqui/basket.tt | 44 ++++++++++++------- .../prog/en/modules/acqui/booksellers.tt | 16 ++++--- 3 files changed, 39 insertions(+), 23 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-add-to-basket.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-add-to-basket.inc index b4f37edb19..f330237f37 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-add-to-basket.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-add-to-basket.inc @@ -1,5 +1,5 @@
- Add order to basket + Add order to basket [% IF has_budgets %]
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt index a63dd515e3..1914c5545b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -713,24 +713,27 @@ [% END %]
    - [% UNLESS ( closedate ) %] - - - + [% UNLESS ( closedate ) %] + + [% END %] [% END %] @@ -920,6 +923,13 @@ $("#set_basket_group").show(); }); + $(".modal").on("shown.bs.modal", function(){ + var basket = $(this).data("basketno"); + var legend = _("Add order to basket %s").format(basket); + $(this).find("h4").text( legend ); + $(this).find("legend").html(legend); + $(this).find("input:text").focus(); + }); }); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt index 0fb92fe568..7a35a24842 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt @@ -172,17 +172,21 @@ [% END %] + + [% END %] @@ -230,10 +234,12 @@ var id = $(this).find("option:selected").val(); window.location.href = "#" + id; }); - $(".modal").on("show", function(){ + $(".modal").on("shown.bs.modal", function(){ var basket = $(this).data("basketno"); var legend = _("Add order to basket %s").format(basket); + $(this).find("h4").text( legend ); $(this).find("legend").html(legend); + $(this).find("input:text").focus(); }); $("#show_all_vendors").hide(); $("#show_active_vendors").on('click', function(e){ -- 2.39.5