Bug 16967: Remove the use of "onclick" from serial frequency and numbering management

This patch removes instance of "onclick" from the templates for serial
frequency and numbering management. Events are now defined in the
JavaScript.

To test, apply the patch and go to Serials -> Manage frequencies.

 - In the list of frequencies, click the "Delete" button for a frequency
   which is in use by at least one subscription. In the confirmation
   dialog, clicking the "Show subscriptions" link should display a list
   of titles.
 - Edit or create a frequency.
 - To test that the form submission validation is still working
   correctly, enter non-numeric data in the "issues per unit" field and
   submit the form. This should trigger an error.

In Serials -> Manage numbering patterns:

 - In the list of numbering patterns, click the "Delete" button for a
   pattern which is in use by at least one subscription. In the
   confirmation dialog, clicking the "Show subscriptions" link should
   display a list of titles.
 - Edit or create a numbering pattern.
 - Confirm that the "Test pattern" button works correctly.

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as advertised

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Owen Leonard 2016-07-22 14:48:36 -04:00 committed by Kyle M Hall
parent 062a70cb61
commit 9707a439cb
2 changed files with 18 additions and 8 deletions

View file

@ -44,10 +44,6 @@ function check_form() {
return false;
}
function show_blocking_subs() {
$("#blocking_subs").show();
}
$(document).ready(function() {
$("#issuesperunit").change(function() {
var value = $(this).val();
@ -64,6 +60,13 @@ $(document).ready(function() {
$(".delete_frequency").on("click",function(){
return confirmDelete();
});
$("#add_frequency_form").on("submit",function(){
return check_form();
});
$("#show_blocking_subs").on("click",function(e){
e.preventDefault();
$("#blocking_subs").show();
});
});
//]]>
</script>
@ -99,7 +102,7 @@ $(document).ready(function() {
[% ELSE %]
<h1>Edit frequency: [% description %]</h1>
[% END %]
<form action="/cgi-bin/koha/serials/subscription-frequencies.pl" method="post" onsubmit="return check_form();">
<form action="/cgi-bin/koha/serials/subscription-frequencies.pl" id="add_frequency_form" method="post">
[% IF (modify) %]
<input type="hidden" name="id" value="[% id %]" />
<input type="hidden" name="op" value="savemod" />
@ -168,7 +171,7 @@ $(document).ready(function() {
This frequency is still used by [% subscriptions.size %]
subscription(s). Do you still want to delete it?
</p>
<p><a href="#" onclick="show_blocking_subs(); return false;">Show subscriptions</a></p>
<p><a href="#" id="show_blocking_subs">Show subscriptions</a></p>
<ul id="blocking_subs" style="display:none">
[% FOREACH sub IN subscriptions %]
<li style="list-style-type:none">

View file

@ -66,6 +66,13 @@ $(document).ready(function(){
$(".delete_pattern").on("click",function(){
return confirmDelete();
});
$("#show_blocking_subs").on("click",function(e){
e.preventDefault();
$("#blocking_subs").show();
});
$("#test_pattern").on("click",function(){
testPattern();
});
});
//]]>
</script>
@ -284,7 +291,7 @@ $(document).ready(function(){
</tbody>
</table>
<fieldset class="action">
<input type="button" value="Test pattern" onclick="testPattern();" />
<input type="button" id="test_pattern" value="Test pattern" />
</fieldset>
<div id="predictionpattern"></div>
</fieldset>
@ -298,7 +305,7 @@ $(document).ready(function(){
This pattern is still used by [% subscriptions.size %]
subscription(s). Do you still want to delete it?
</p>
<p><a href="#" onclick="show_blocking_subs(); return false;">Show subscriptions</a></p>
<p><a href="#" id="show_blocking_subs">Show subscriptions</a></p>
<ul id="blocking_subs" style="display:none">
[% FOREACH sub IN subscriptions %]
<li style="list-style-type:none">