From 111a1344811920fa0116177fa5ccb6e4a2cc2bb6 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 18 Nov 2020 13:15:04 +0000 Subject: [PATCH] Bug 7607: (follow-up) Address OPAC and limits This patch adds the same function to the OPAC and adds support for limits I adjust the class on staff side to match the one already existing on OPAC On the OPAC when you click the back button the fields are not enabled - on the staff side they are, I leave this problem for someone else to solve Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart (cherry picked from commit 36a6ce301f961b0cefdca70ed9a903a1216e071f) Signed-off-by: Andrew Fuerste-Henry --- .../prog/en/modules/catalogue/advsearch.tt | 4 ++-- koha-tmpl/intranet-tmpl/prog/js/staff-global.js | 7 ++++++- .../opac-tmpl/bootstrap/en/modules/opac-advsearch.tt | 12 ++++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt index 681b8e84df..e3fe038f0b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt @@ -96,9 +96,9 @@ [% END %] [% FOREACH search_box IN search_boxes_loop %] [% IF ( search_boxes_label ) %] -
+
[% ELSE %] -
+
[% END %] [% IF ( expanded_options ) %] [% IF ( search_box.boolean ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js index da4354e751..375dd4999f 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js @@ -131,8 +131,13 @@ $.fn.selectTabByID = function (tabID) { /* Search results browsing */ /* forms with action leading to search */ $("form[action*='search.pl']").submit(function(){ + $('[name^="limit"]').each(function(){ + if( $(this).val() == '' ){ + $(this).prop("disabled","disabled"); + } + }); var disabledPrior = false; - $(".search_set").each(function(){ + $(".search-term-row").each(function(){ if( disabledPrior ){ $(this).find('select[name="op"]').prop("disabled","disabled"); disabledPrior = false; diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt index f1b4e6dba2..08b8889382 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt @@ -444,6 +444,18 @@ $(document).ready(function() { jQuery.removeCookie("search_path_code", { path: '/'}); [% END %] $('#advsearch form').submit(function() { + $('[name^="limit"]').each(function(){ + if( $(this).val() == '' ){ + $(this).prop("disabled","disabled"); + } + }); + $(".search-term-row").each(function(){ + if( $(this).find('input[name="q"]').val() == "" ){ + $(this).find('input[name="q"]').prop("disabled","disabled"); + $(this).find('select[name="op"]').prop("disabled","disabled"); + $(this).find('select[name="idx"]').prop("disabled","disabled"); + } + }); form_serialized = $(this).serialize(); jQuery.cookie("form_serialized", form_serialized,{ path: '/'}); form_serialized_limits = [ -- 2.39.5