From 672277197dbb910a1bd3f1239467242253869066 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 28 Apr 2016 20:52:40 -0400 Subject: [PATCH] Bug 16386 - Replace the use of "onclick" from patron card creator templates This patch removes the use of "onclick" from several patron card creator templates. Events are defined instead in JavaScript. Also changed: - Patron search pop-up window is now slightly larger because I found it never quite large enough to prevent horizontal scrolling. - Replaced "Borrower" with "Patron" in a couple of places. - "Add" link in patron search pop-up is now styled as a Bootstrap button. - Removed Bootstrap styles from some submit buttons. - Some Font Awesome icons were made using the invalid element instead of . These are corrected. - Fixed some other HTML validation errors. To test, apply the patch and go to Tools -> Patron card creator. - Choose New -> Card batch. - Click "Add patrons" and perform a search for patrons in the pop-up window. - Click the "Add" button. The corresponding borrowernumber should be added to the textarea in the parent window, and a message should appear at the top of the pop-up window confirming that the patron has been added. (Note: This patch fixes a version of Bug 13041 which prevented the "add" button from working on patrons whose name include an apostrophe). - In the parent page, in the list of patrons you added to the batch, confirm that clicking the "Delete" link triggers a confirmation dialog. Test both confirming and canceling. - Confirm that clicking the "Export" button next to an individual patron triggers a modal window. - In the export window, confirm that the "Cancel" link works to close the modal. - Click the "Export" button again and then the "Export" button in the modal. - Test that the "Done" button works to close the modal. - Choose Manage -> Card batches. - Test the "Delete" and "Export" buttons as described above. Signed-off-by: Bernardo Gonzalez Kriegel All works, no errors. Signed-off-by: Katrin Fischer Signed-off-by: Brendan Gallagher --- .../prog/en/modules/common/patron_search.tt | 13 +++++++-- .../prog/en/modules/patroncards/edit-batch.tt | 28 ++++++++++++------- .../en/modules/patroncards/image-manage.tt | 2 +- .../prog/en/modules/patroncards/manage.tt | 19 +++++++++---- .../prog/en/modules/patroncards/print.tt | 12 ++++++-- .../patroncards/tables/members_results.tt | 2 +- 6 files changed, 52 insertions(+), 24 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt index c1ce712ac0..41c83d805f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/common/patron_search.tt @@ -100,6 +100,13 @@ $(document).ready(function(){ e.preventDefault(); filterByFirstLetterSurname($(this).text()); }); + $("body").on("click",".add_user",function(e){ + e.preventDefault(); + var borrowernumber = $(this).data("borrowernumber"); + var firstname = $(this).data("firstname"); + var surname = $(this).data("surname"); + add_user( borrowernumber, firstname + " " + surname ); + }); }); function filter() { @@ -133,10 +140,10 @@ function filterByFirstLetterSurname(letter) { $("#info").hide(); $("#error").hide(); if ( p.add_user(borrowernumber, borrowername) < 0 ) { - $("#error").html(_("Borrower '%s' is already in the list.").format(borrowername)); + $("#error").html(_("Patron '%s' is already in the list.").format(borrowername)); $("#error").show(); } else { - $("#info").html(_("Borrower '%s' added.").format(borrowername)); + $("#info").html(_("Patron '%s' added.").format(borrowername)); $("#info").show(); } } @@ -189,7 +196,7 @@ function filterByFirstLetterSurname(letter) {
- +
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt index 665283639c..9131ee4c05 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/edit-batch.tt @@ -6,7 +6,6 @@ [% INCLUDE 'datatables.inc' %] @@ -201,12 +209,12 @@
[% IF ( table_loop ) %]
@@ -238,8 +246,8 @@ [% FOREACH text_field IN table_loo.text_fields %] [% IF ( text_field.select_field ) %] - Delete - Export + Delete + Export [% ELSE %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/image-manage.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/image-manage.tt index 84b58ebc5c..17387bdc07 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/image-manage.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/image-manage.tt @@ -135,7 +135,7 @@ [% FOREACH text_field IN TABL.text_fields %] [% IF ( text_field.select_field ) %] - Delete + Delete [% ELSIF ( text_field.field_value ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/manage.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/manage.tt index 331eede4bc..a75a924cf6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/manage.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/manage.tt @@ -26,7 +26,6 @@ [% INCLUDE 'greybox.inc' %] @@ -200,11 +207,11 @@ [% FOREACH text_field IN table_loo.text_fields %] [% IF ( text_field.select_field ) %] - Edit - [% IF ( print ) %] Export[% END %] - Delete + Edit + [% IF ( print ) %] Export[% END %] + Delete - [% IF ( print ) %][% END %] + [% IF ( print ) %][% END %] [% ELSIF ( text_field.field_value ) %] [% text_field.field_value %] [% ELSE %] @@ -216,7 +223,7 @@ [% END %]
- [% IF ( print ) %][% END %] + [% IF ( print ) %][% END %]
[% IF patron_lists %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/print.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/print.tt index bf2284243a..c6619ab435 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/print.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/print.tt @@ -6,6 +6,11 @@ function Done() { window.location = "[% referer %]"; }; + $(document).ready(function(){ + $(".gb-close").on("click",function(){ + parent.parent.GB_hide(); + }); + }) //]]> @@ -38,7 +43,7 @@
- +
[% ELSIF ( patronlist_id && template_id && layout_id ) %] @@ -95,10 +100,11 @@
- - Cancel + + Cancel
[% END %] + [% INCLUDE 'popup-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/tables/members_results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/tables/members_results.tt index 087aa8c705..e3455be8cf 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/tables/members_results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/tables/members_results.tt @@ -19,7 +19,7 @@ "dt_borrowernotes": "[% data.borrowernotes.replace('\\\\' , '\\\\') |html |html_line_break |collapse %]", "dt_action": - "Add" + " Add" }[% UNLESS loop.last %],[% END %] [% END %] ] -- 2.39.5