From b1f198600f02b1f0389ddf63c809a312b77e8f2a Mon Sep 17 00:00:00 2001 From: Alex Arnaud Date: Tue, 2 Apr 2019 15:20:34 +0200 Subject: [PATCH] Bug 21959: use a link instead of a checkbox Signed-off-by: Mathilde Formery Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize --- .../prog/en/modules/tools/batchMod-edit.tt | 49 ++++++++++--------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt index 8097f4185f..d82b77070f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt @@ -24,37 +24,38 @@ $(document).ready(function(){ var row = $(this).attr("id"); row = row.replace("row","hint"); var todisable = $(this).parent().find("[name='field_value'],[name='tag'],[name='subfield'],[name='mandatory']"); - var regex_input = $(this).parent().find("[name='field_regex']"); + var regex_link = $(this).parent().find("[name='field_regex']"); if ($(this).is(":checked")) { $(todisable).prop('disabled', true); $("#"+row).html(_("This subfield will be deleted")); - $(regex_input).prop('disabled', true); + $(regex_link).hide(); } else { $(todisable).prop('disabled', false); $("#"+row).html(""); - $(regex_input).prop('disabled', false); + $(regex_link).show(); } }); $("#mainformsubmit").on("click",function(){ return submitBackgroundJob(this.form); }); - $('input[name="field_regex"]').change(function() { - var id = $(this).attr('id'); - var editor = $(this).parent().find("[name='field_value']"); - var regex = $(this).parent().find("[name='regex_fields']"); - var disable_input = $(this).parent().find("[name='disable_input']"); - if ($(this).is(':checked')) { - $(editor).hide(); - $(regex).show(); - $(this).parent().find('.hint').html(_("Enter a regular expression for this subflied")); - $(disable_input).prop('disabled', true); - } else { - $(editor).show(); - $(regex).hide(); - $(this).parent().find('.hint').html(_("")); - $(disable_input).prop('disabled', false); - } - }); + $('a[name="field_regex"]').click(function() { + var id = $(this).attr('id'); + var editor = $(this).parent().find("[name='field_value']"); + var regex = $(this).parent().find("[name='regex_fields']"); + var disable_input = $(this).parent().find("[name='disable_input']"); + if ($(this).html() == 'RegEx') { + $(editor).hide(); + $(regex).show(); + $(this).html('Text'); + $(disable_input).prop('disabled', true); + } else { + $(editor).show(); + $(regex).hide(); + $(this).html('RegEx'); + $(disable_input).prop('disabled', false); + } + return false; + }); }); //]]> @@ -306,9 +307,9 @@ $(document).ready(function(){ [%- END -%] - s// - / - + s// + / + [% UNLESS ( ite.mandatory ) %] @@ -318,7 +319,7 @@ $(document).ready(function(){ [% END %] [% IF (mv.type == 'text' || mv.type == 'textarea' ) %] - + RegEx [% END %] -- 2.39.5