Bug 24391: Remove event attributes from patron clubs edit template

This patch removes "onclick" attributes from the template for adding and
editing patron club templates.

To test, apply the patch and go to Tools -> Patron clubs -> New club
template.

Test the process of adding and deleting both club and enrollment fields.
Test during the template add process and when editing an existing
template.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Owen Leonard 2020-01-09 17:45:47 +00:00 committed by Martin Renvoize
parent fd35064657
commit feb625ce50
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 30 additions and 4 deletions

View File

@ -1,5 +1,6 @@
[% USE Branches %]
[% USE AuthorisedValues %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Tools &rsaquo; Patron clubs &rsaquo;
[% IF club_template %]
@ -124,7 +125,7 @@
[% END %]
</div>
<fieldset class="action">
<a href="#" onclick="$('#new-field-template').clone().attr('id','').show().appendTo('#club-template-fields'); return false;">
<a href="#" class="add_club_field">
<i class="fa fa-plus"></i> Add new field
</a>
</fieldset>
@ -169,7 +170,7 @@
[% END %]
</div>
<fieldset class="action">
<a href="#" onclick="$('#new-enrollment-field-template').clone().attr('id','').show().appendTo('#club-template-enrollment-fields'); return false;">
<a href="#" class="add_enrollment_field">
<i class="fa fa-plus"></i> Add new field
</a>
</fieldset>
@ -209,7 +210,7 @@
</select>
</li>
</ol>
<fieldset class="action"><a href="#" onclick="$(this).parent().parent().remove(); return false;"><i class="fa fa-trash"></i> Delete field</a></fieldset>
<fieldset class="action"><a href="#" class="delete_club_field"><i class="fa fa-trash"></i> Delete field</a></fieldset>
<hr/>
</div>
@ -236,7 +237,32 @@
</select>
</li>
</ol>
<fieldset class="action"><a href="#" onclick="$(this).parent().parent().remove(); return false;"><i class="fa fa-trash"></i> Delete field</a></fieldset>
<fieldset class="action"><a href="#" class="delete_enrollment_field"><i class="fa fa-trash"></i> Delete field</a></fieldset>
</div>
[% MACRO jsinclude BLOCK %]
<script>
$("body").on("click", ".add_club_field", function(e){
e.preventDefault();
$("#new-field-template").clone().attr("id","").show().appendTo("#club-template-fields");
});
$("body").on("click", ".delete_club_field", function(e){
e.preventDefault();
$(this).parent().parent().remove();
});
$("body").on("click", ".delete_enrollment_field", function(e){
e.preventDefault();
$(this).parent().parent().remove();
});
$("body").on("click", ".add_enrollment_field", function(e){
e.preventDefault();
$('#new-enrollment-field-template').clone().attr('id','').show().appendTo('#club-template-enrollment-fields');
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]