From 444b8fd4868000565aff8394c8c7fa91ed8afdff Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 30 Jul 2018 14:01:36 +0000 Subject: [PATCH] Bug 18530: Remove event attributes from patron clubs templates This patch removes event attributes like "onclick" from patron clubs templates in favor of putting these event handlers in the JavaScript. To test, apply the patch and go to Tools -> Patron clubs. - Test deletion of both club templates and clubs. Deletion confirmation dialogs should work as expected, both for OK and Cancel. - Test editing of a club template. Under "Club fields," the "Add new field" and "Delete field" links should work correctly. - Open a patron record for checkout. - Test enrolling and un-enrolling the patron. - Test the same process from the patron detail page. --- .../intranet-tmpl/prog/en/includes/strings.inc | 5 +- .../prog/en/modules/circ/circulation.tt | 1 + .../intranet-tmpl/prog/en/modules/clubs/clubs.tt | 18 ++++- .../prog/en/modules/clubs/patron-clubs-tab.tt | 38 +--------- .../prog/en/modules/clubs/patron-enroll.tt | 33 +-------- .../prog/en/modules/clubs/templates-add-modify.tt | 24 +++++-- .../prog/en/modules/members/moremember.tt | 1 + .../intranet-tmpl/prog/js/pages/circulation.js | 82 +++++++++++++++++++++- 8 files changed, 124 insertions(+), 78 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc index cb90180..62aa46f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc @@ -1,5 +1,4 @@ - diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index 6700b0e..b9a792e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -1001,6 +1001,7 @@ No patron matched [% message | html %] [% FOREACH b IN relatives_borrowernumbers %] relatives_borrowernumbers.push("[% b | html %]"); [% END %] + var club_id = "[% club.id %]"; var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export"); var MSG_CONFIRM_DELETE_MESSAGE = _("Are you sure you want to delete this message? This cannot be undone."); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt index 1dff30d..b3d42af 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt @@ -88,7 +88,7 @@ Edit - + Delete [% END %] @@ -196,7 +196,7 @@
  • - + Delete
  • @@ -248,6 +248,20 @@ } )); }); + $(".delete_template").on("click", function(e){ + e.preventDefault(); + var name = $(this).data("name"); + var id = $(this).data("id"); + ConfirmDeleteTemplate( id, name, $(this) ); + }); + + $(".delete_club").on("click", function(e){ + e.preventDefault(); + var name = $(this).data("name"); + var id = $(this).data("id"); + ConfirmDeleteClub( id, name, $(this) ); + }); + function ConfirmDeleteTemplate( id, name, a ) { if ( confirm( _("Are you sure you want to delete the club template %s? This will delete all clubs using this template and cancel patron enrollments" ).format(name) ) ) { $.ajax({ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-clubs-tab.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-clubs-tab.tt index 94dca4f..ad65078 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-clubs-tab.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-clubs-tab.tt @@ -21,7 +21,7 @@ [% e.date_enrolled | $KohaDates %] [% IF CAN_user_clubs_enroll %] - @@ -33,7 +33,6 @@ [% END %] [% IF clubs %] -

    Clubs not enrolled in

    @@ -52,7 +51,7 @@ [% IF CAN_user_clubs_enroll %] @@ -62,36 +61,3 @@
    [% c.description | html %] -
    [% END %] - -[% IF CAN_user_clubs_enroll %] - -[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-enroll.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-enroll.tt index 350e81c..86a1f13 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-enroll.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/patron-enroll.tt @@ -28,39 +28,10 @@ [% END %]
  • - Finish enrollment - Cancel + Finish enrollment + Cancel
  • - - diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/templates-add-modify.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/templates-add-modify.tt index 063c55a..2f165b1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/templates-add-modify.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/templates-add-modify.tt @@ -1,5 +1,6 @@ [% USE Branches %] [% USE AuthorisedValues %] +[% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Tools › Patron clubs › [% IF club_template %] @@ -9,7 +10,7 @@ [% END %] [% INCLUDE 'doc-head-close.inc' %] -