Bug 28445: UI change for repeatable and regex

This patch applies the changes describe in the main commit message about
the "limitation" and "the behaviour in master was buggy".

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2021-07-27 15:29:38 +02:00
parent 424aca3d56
commit 9e18b9403c
2 changed files with 15 additions and 0 deletions

View File

@ -260,6 +260,13 @@
$(tag_editor).hide();
$(this).html('Text');
$(disable_input).prop('disabled', true);
let input_name = $(editor).attr('name');
let cloned = $("input[name='"+input_name+"']");
if ( cloned.length > 1 ) {
for( i = 1 ; i < cloned.length ; i++){
$(cloned[i]).parent().remove();
}
}
} else {
$(editor).show();
$(tag_editor).show();

View File

@ -543,6 +543,14 @@ function CloneItemSubfield(original){
var new_id = original.getAttribute('id')+new_key;
clone.setAttribute('id',new_id);
// Don't clone "RegEx". We don't handle it for repeatable subfields
var links = clone.getElementsByTagName('a');
for( i = 0 ,len = links.length ; i < len ; i++){
if( $(links[i]).hasClass('field_regex') ) {
$(links[i]).remove();
}
}
// insert this line on the page
original.parentNode.insertBefore(clone,original.nextSibling);
Select2Utils.initSelect2($(original).find('select'));