Bugzilla – Attachment 53479 Details for
Bug 16938
Remove the use of "onclick" from batch patrons modification template
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16938 - Remove the use of "onclick" from batch patrons modification template
Bug-16938---Remove-the-use-of-onclick-from-batch-p.patch (text/plain), 5.50 KB, created by
Owen Leonard
on 2016-07-18 19:04:52 UTC
(
hide
)
Description:
Bug 16938 - Remove the use of "onclick" from batch patrons modification template
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2016-07-18 19:04:52 UTC
Size:
5.50 KB
patch
obsolete
>From e7258e1efeb06086ba3dae66e2bbd1c340ccfe52 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Mon, 18 Jul 2016 14:44:13 -0400 >Subject: [PATCH] Bug 16938 - Remove the use of "onclick" from batch patrons > modification template >Content-Type: text/plain; charset="utf-8" > >This patch revises the batch patrons modification template, removing >"onclick" attributes from the markup and defining those events in the >script. > >To test you should have at least one extended patron attribute >configured. > >- Apply the patch and go to Tools -> Batch patron modification. >- Submit a batch of patrons for modification. >- Confirm that the checkbox next to any required field is disabled. >- Select a date in the registration date and expiry date fields. Confirm > that the "Clear" link next to each empties the correct field. >- Click "New" next to a patron attibute. A copy of the patron attribute > line should be created. >- Click "Delete" next to a cloned patron attribute. The correct line > should be removed. >--- > .../prog/en/modules/tools/modborrowers.tt | 25 ++++++++++++++++------ > 1 file changed, 19 insertions(+), 6 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt >index 54227e6..3c12f0a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt >@@ -58,7 +58,20 @@ > > $('select[name="patron_attributes"]').change(); > >- } ); >+ $(".clear-date").on("click",function(e){ >+ e.preventDefault(); >+ var fieldID = this.id.replace("clear-date-",""); >+ $("#" + fieldID).val(""); >+ }); >+ $("#cataloguing_additem_newitem").on("click",".add_attributes",function(e){ >+ e.preventDefault(); >+ add_attributes(); >+ }); >+ $("#cataloguing_additem_newitem").on("click",".del_attributes",function(e){ >+ e.preventDefault(); >+ del_attributes(this); >+ }); >+ }); > > function updateAttrValues (select_attr) { > var attr_code = $(select_attr).val(); >@@ -84,8 +97,8 @@ > function add_attributes() { > var li_node = $("li.attributes:last"); > var li_clone = $(li_node).clone(); >- if ( $(li_clone).find("a.delete").length == 0 ) { >- $(li_clone).append('<a href="#" title="Delete" class="delete" onclick="del_attributes(this);return false;"><i class="fa fa-fw fa-trash"></i> Delete</a>'); >+ if ( $(li_clone).find("a.del_attributes").length == 0 ) { >+ $(li_clone).append('<a href="#" title="Delete" class="del_attributes"><i class="fa fa-fw fa-trash"></i> Delete</a>'); > } > $(li_clone).find('select[name="patron_attributes"]').change(function() { > updateAttrValues(this); >@@ -335,7 +348,7 @@ > [% END %] > </label> > [% IF field.mandatory %] >- <input type="checkbox" title="This field is mandatory" name="disable_input" value="[% field.name %]" readonly="readonly" onclick="return false;" /> >+ <input type="checkbox" title="This field is mandatory" name="disable_input" value="[% field.name %]" disabled="disabled" readonly="readonly" /> > [% ELSE %] > <input type="checkbox" title="Check to delete this field" name="disable_input" value="[% field.name %]" /> > [% END %] >@@ -355,7 +368,7 @@ > [% END %] > [% IF ( field.type == 'date' ) %] > <input type="text" name="[% field.name %]" id="[% field.name %]" value="" size="10" maxlength="10" readonly="readonly" class="datepicker" /> >- <a href="#" onclick="clearDate('[% field.name %]');return false;"><i class="fa fa-fw fa-trash"></i> Clear</a> >+ <a href="#" class="clear-date" id="clear-date-[% field.name %]" ><i class="fa fa-fw fa-trash"></i> Clear</a> > [% END %] > [% IF field.mandatory %] > <span class="required">Required fields cannot be cleared</span> >@@ -373,7 +386,7 @@ > </label> > <input type="checkbox" title="check to delete this field" name="disable_input" value="attr0_value" /> > <span class="patron_attributes_value"></span> >- <a href="#" title="Add an attribute" onclick="add_attributes(); return false;"><i class="fa fa-fw fa-plus"></i> New</a> >+ <a href="#" class="add_attributes" title="Add an attribute"><i class="fa fa-fw fa-plus"></i> New</a> > <span class="information_category hint" style="width:25%;float:right;"></span> > </li> > [% END %] >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 16938
:
53479
|
53495
|
53682
|
55440