From 0c476f15082893cb2ee66271009fb09d3f698c23 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 19 May 2016 09:41:24 -0400 Subject: [PATCH] Bug 16557 - Remove the use of "onclick" from several include files This patch modifies several include files, removing "onclick" attributes in favor of defining events in JavaScript. A reusable "toggle" function has been added to the global JS file so that clicking elements with the class "toggle_element" will toggle the display of elements as defined in the click target's "data-element" attribute. Also changed: In subtypes_unimarc.inc some capitalization errors have been fixed and label/id pairs corrected. To test, apply the patch and clear your browser cache if necessary. - On the Acquisitions home page, click the "Orders search" header search tab. Clicking the [+] link should expand and collapse the additional search fields. - On the checkout or patron detail page, view the "Restrictions" tab. Click to add a restriction and use the datepicker to select a date. Clicking the "Clear date" link should clear the date. - Trigger the help window on any page. Clicking the "close window" button should work correctly. - Go to Administration -> Patron categories -> Edit. Checking and unchecking messaging preference options should work correctly. The "do not notify" checkbox should clear other checkboxes in that row and vice versa. - In Serials, from a subscription detail page, clicking the "Renew" button should trigger the renew popup. - Go to Acquisitions -> Vendor -> Add to basket -> From a subscription. Clicking the "Advanced search" link in the left hand sidebar should toggle the sidebar search form. - In a UNIMARC system, view the advanced search page. Clicking the "Show coded information filters" link should show additional search fields. (I tested in my MARC21 system by temporarily moving line 174 of advsearch.tt to line 172). Signed-off-by: Claire Gravely Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- .../prog/en/includes/acquisitions-search.inc | 4 +- .../prog/en/includes/borrower_debarments.inc | 7 +- .../prog/en/includes/help-bottom.inc | 2 +- .../en/includes/messaging-preference-form.inc | 26 ++++--- .../prog/en/includes/serials-toolbar.inc | 2 +- .../prog/en/includes/subscriptions-search.inc | 2 +- .../prog/en/includes/subtypes_unimarc.inc | 73 ++++++++++--------- .../intranet-tmpl/prog/js/staff-global.js | 6 ++ 8 files changed, 72 insertions(+), 50 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-search.inc index 5aebf54b73..26ab7f1c70 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-search.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-search.inc @@ -14,8 +14,8 @@ - - [+] + + [+] Advanced search
  1. - Clear date
  2. + Clear date
Cancel
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/help-bottom.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/help-bottom.inc index b7b72c7cc7..9a2fb5af6d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/help-bottom.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/help-bottom.inc @@ -1,5 +1,5 @@
-
+
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc index 953b9ef388..a5da438d7c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc @@ -5,7 +5,7 @@ $(document).ready(function(){ $(".none").click(function(){ if($(this).prop("checked")){ var rowid = $(this).attr("id"); - newid = Number(rowid.replace("none","")) + newid = Number(rowid.replace("none","")); $("#sms"+newid).prop("checked", false); $("#email"+newid).prop("checked", false); $("#phone"+newid).prop("checked", false); @@ -13,6 +13,12 @@ $(document).ready(function(){ $("#rss"+newid).prop("checked", false); } }); + $(".active_notify").on("change",function(){ + var attr_id = $(this).data("attr-id"); + if( $(this).prop("checked") ){ + $("#none" + attr_id ).prop("checked", false); + } + }); $("#info_digests").tooltip(); }); //]]> @@ -75,12 +81,12 @@ $(document).ready(function(){ + value="sms" checked="checked" class="active_notify" data-attr-id="[% messaging_preference.message_attribute_id %]" /> [% ELSE %] + value="sms" class="active_notify" data-attr-id="[% messaging_preference.message_attribute_id %]" /> [% END %] [% END %] [% END %] @@ -103,12 +109,12 @@ $(document).ready(function(){ + value="phone" checked="checked" class="active_notify" data-attr-id="[% messaging_preference.message_attribute_id %]" /> [% ELSE %] + value="phone" class="active_notify" data-attr-id="[% messaging_preference.message_attribute_id %]" /> [% END %] [% END %] [% END %] @@ -132,12 +138,12 @@ $(document).ready(function(){ + value="email" checked="checked" class="active_notify" data-attr-id="[% messaging_preference.message_attribute_id %]" /> [% ELSE %] + value="email" class="active_notify" data-attr-id="[% messaging_preference.message_attribute_id %]" /> [% END %] [% END %] @@ -164,12 +170,12 @@ $(document).ready(function(){ + name="digest" checked="checked" class="active_notify" data-attr-id="[% messaging_preference.message_attribute_id %]" /> [% ELSE %] + name="digest" class="active_notify" data-attr-id="[% messaging_preference.message_attribute_id %]" /> [% END %] [% END %] @@ -188,7 +194,7 @@ $(document).ready(function(){ + value="rss" [% messaging_preference.transport_rss %] class="active_notify" data-attr-id="[% messaging_preference.message_attribute_id %]" /> [% END %] [% ELSE %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc index 729d2eed01..02348b2868 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc @@ -67,7 +67,7 @@ [% IF not cannotedit or CAN_user_serials_receive_serials %] [% IF CAN_user_serials_renew_subscription and not closed %] - + [% END %] [% IF CAN_user_serials_receive_serials and not closed %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/subscriptions-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/subscriptions-search.inc index 4f6f1caed1..9d6abd7040 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/subscriptions-search.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/subscriptions-search.inc @@ -1,7 +1,7 @@
- Advanced search + Advanced search