From c386f36fd0ff2dade7d12fab9f4b7048426df5d9 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 9 Jan 2020 19:09:31 +0000 Subject: [PATCH] Bug 24393: Remove event attributes from patron clubs list template This patch removes some instances of the "onclick" attributes from the template that lists patron clubs and templates. To test, apply the patch and go to Tools -> Patron clubs. - Test the process of deleting a club template. Clicking the "Delete" button should trigger a confirmation. Confirming should delete the template. - Test the process of deleting a club. In the "Clubs" section of the page, click the "Actions" menu next to any club. Clicking the "Delete" link should trigger a confirmation. Confirming should delete the club. - Also in the "Clubs" section of the page, find a club which has enrollments. Select "Search to hold" from the "Actions" menu. It should take you to the advanced search. On the search results page you should have the option to place a hold for the club you selected. --- .../intranet-tmpl/prog/en/includes/clubs-table.inc | 4 ++-- .../intranet-tmpl/prog/en/modules/clubs/clubs.tt | 26 +++++++++++++++++++--- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/clubs-table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/clubs-table.inc index 62027b1a385..06869538aad 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/clubs-table.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/clubs-table.inc @@ -89,14 +89,14 @@
  • - + Delete
  • [% END %] [% IF ( c.club_enrollments.count ) %]
  • - + Search to hold
  • 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 e4176a9da05..2258635d922 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/clubs/clubs.tt @@ -87,7 +87,7 @@ Edit - + Delete [% END %] @@ -159,9 +159,29 @@ { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, ] } )); + + $(".delete_club").on("click", function(e){ + e.preventDefault(); + var club_id = $(this).data("id"); + var club_name = $(this).data("name"); + ConfirmDeleteClub( club_id, club_name ); + }); + + $(".delete_template").on("click", function(e){ + e.preventDefault(); + var template_id = $(this).data("id"); + var template_name = $(this).data("name"); + ConfirmDeleteTemplate( template_id, template_name ); + }); + + $(".club_hold_search").on("click", function(e){ + e.preventDefault; + var club_id = $(this).data("id"); + SearchToHold( club_id ); + }); }); - function ConfirmDeleteTemplate( id, name, a ) { + function ConfirmDeleteTemplate( id, name ) { 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({ type: "POST", @@ -179,7 +199,7 @@ } } - function ConfirmDeleteClub( id, name, a ) { + function ConfirmDeleteClub( id, name ) { if ( confirm( _("Are you sure you want to delete the club %s? This will cancel all patron enrollments in this club." ).format(name) ) ) { $.ajax({ type: "POST", -- 2.11.0