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 <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 36a6ce301f)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2020-11-18 13:15:04 +00:00 committed by Andrew Fuerste-Henry
parent 779861f370
commit 111a134481
3 changed files with 20 additions and 3 deletions

View File

@ -96,9 +96,9 @@
[% END %]
[% FOREACH search_box IN search_boxes_loop %]
[% IF ( search_boxes_label ) %]
<div class="search_set" style="text-indent: 4.5em;">
<div class="search-term-row" style="text-indent: 4.5em;">
[% ELSE %]
<div class="search_set">
<div class="search-term-row">
[% END %]
[% IF ( expanded_options ) %]
[% IF ( search_box.boolean ) %]

View File

@ -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;

View File

@ -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 = [