From 32833f95dbf8fd2559b2da4146b30e850182ee0f Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Wed, 20 Apr 2016 10:29:03 -0400 Subject: [PATCH] Bug 16310 - Remove the use of "onclick" from audio alerts template MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch removes one use of "onclick" in favor of defining events in the JavaScript. This patch also makes changes to the style of some buttons to make the interface a little more consistent with current practices. To test, apply the patch and go to Administration -> Audio alerts. - In the list of existing audio alerts, click the "Edit" button for any alert. The correct data should be loaded in the edit form. Signed-off-by: Marc Véron Signed-off-by: Katrin Fischer Signed-off-by: Kyle M Hall (cherry picked from commit fcd139b22239206142809993cf9e328a3cdce38d) Signed-off-by: Frédéric Demians --- .../prog/en/modules/admin/audio_alerts.tt | 5 +++-- koha-tmpl/intranet-tmpl/prog/js/audio_alerts.js | 10 ++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/audio_alerts.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/audio_alerts.tt index 2a6a8a7984..e43f173b24 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/audio_alerts.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/audio_alerts.tt @@ -111,14 +111,15 @@ [% a.selector %] [% a.sound %] - Edit + + Edit [% END %]

- +

diff --git a/koha-tmpl/intranet-tmpl/prog/js/audio_alerts.js b/koha-tmpl/intranet-tmpl/prog/js/audio_alerts.js index f16f050f68..997c72a412 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/audio_alerts.js +++ b/koha-tmpl/intranet-tmpl/prog/js/audio_alerts.js @@ -65,6 +65,16 @@ $( document ).ready(function() { return false; } }); + + $(".edit").on("click",function(e){ + e.preventDefault(); + var elt = this; + var id = $(this).data("soundid"); + var precedence = $(this).data("precedence"); + var selector = $(this).data("selector"); + var sound = $(this).data("sound"); + EditAlert( elt, id, precedence, selector, sound ); + }); }); function enablePlayButton(sound_field_value,playbutton){ -- 2.39.2