Bug 19682: Move JS to the footer: Two patron-related tools

This patch modifies two patron-related tools templates in the staff
client so that JavaScript is included in the footer instead of the
header.

To test, apply the patch and test the JavaScript-driven features of
each modified template: All button controls, DataTables functionality,
form validation, etc.

  - Import patrons
  - Upload patron images

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>

Edit for QA: Fixed datepickers on import patron form

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Owen Leonard 2017-11-22 19:33:48 +00:00 committed by Jonathan Druart
parent de454ff552
commit 6b2da53bc1
2 changed files with 44 additions and 31 deletions

View File

@ -1,5 +1,6 @@
[% USE Koha %]
[% USE Branches %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Tools &rsaquo; Import patrons [% IF ( uploadborrowers ) %]&rsaquo; Results[% END %]</title>
[% INCLUDE 'doc-head-close.inc' %]
@ -9,20 +10,11 @@
.line_error { width: 100%; }
code { background-color: yellow; }
</style>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function() {
[%# Make date fields have the datepicker %]
$("#dateenrolled").addClass('datepicker');
$("#dateexpiry").addClass('datepicker');
$("#dateofbirth").addClass('datepicker');
});
</script>
</head>
<body id="tools_import_borrowers" class="tools">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'patron-search.inc' %]
[% INCLUDE 'calendar.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; <a href="/cgi-bin/koha/tools/import_borrowers.pl">Import patrons</a>[% IF ( uploadborrowers ) %] &rsaquo; Results[% END %]</div>
@ -245,4 +237,17 @@ Alternatively, you can supply dates in ISO format.
[% INCLUDE 'tools-menu.inc' %]
</div>
</div>
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'calendar.inc' %]
<script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script>
<script type="text/javascript" src="[% interface %]/[% theme %]/js/members-menu.js"></script>
<script type="text/javascript">
$(document).ready(function() {
[%# Make date fields have the datepicker %]
$("#dateenrolled, #dateexpiry, #dateofbirth").datepicker();
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]

View File

@ -1,28 +1,9 @@
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Tools &rsaquo; Upload patron images</title>
[% INCLUDE 'doc-head-close.inc' %]
<script type="text/javascript">
$(document).ready(function() {
$("#zipfile").click(function(){
$("#cardnum").hide();
});
$("#image").click(function(){
$("#cardnum").show();
});
$( "#upload_form" ).validate({
rules: {
cardnumber: {
required: {
depends: function(element) {
return $("#image").is(":checked");
}
}
}
}
});
});
</script>
</head>
<body id="tools_picture-upload" class="tools">
[% INCLUDE 'header.inc' %]
@ -157,4 +138,31 @@
[% INCLUDE 'tools-menu.inc' %]
</div>
</div>
[% MACRO jsinclude BLOCK %]
<script type="text/javascript" src="[% interface %]/[% theme %]/js/tools-menu.js"></script>
<script type="text/javascript" src="[% interface %]/[% theme %]/js/members-menu.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#zipfile").click(function(){
$("#cardnum").hide();
});
$("#image").click(function(){
$("#cardnum").show();
});
$( "#upload_form" ).validate({
rules: {
cardnumber: {
required: {
depends: function(element) {
return $("#image").is(":checked");
}
}
}
}
});
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]