From bc1e2ee9560f01c5cb280ca2bc51aa4cb299488c Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 23 Apr 2021 12:20:07 +0000 Subject: [PATCH] Bug 13613: (follow-up) Add tooltip when disabled This patch adds a tooltip to the digest checkboxes when disabled. When enabled the tooltip is hidden Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart (cherry picked from commit 5d176758fe4139f2c2bb226cdd8e9ed7b305fc4f) Signed-off-by: Fridolin Somers --- .../en/includes/messaging-preference-form.inc | 8 ++++---- .../prog/js/messaging-preference-form.js | 14 ++++++++------ .../bootstrap/en/modules/opac-messaging.tt | 16 ++++++++-------- 3 files changed, 20 insertions(+), 18 deletions(-) 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 3788516718..3581adb637 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 @@ -186,24 +186,24 @@ + name="digest" class="pmp_digest" checked="checked" disabled="disabled" data-toggle="tooltip" title="You must select a digestible transport to select digests" /> [% ELSE %] + name="digest" class="pmp_digest" disabled="disabled" data-toggle="tooltip" title="You must select a digestible transport to select digests" /> [% END %] [% ELSE %] [% IF ( messaging_preference.digest ) %] + name="digest" checked="checked" class="pmp_digest active_notify" data-attr-id="[% messaging_preference.message_attribute_id | html %]" data-toggle="tooltip" title="You must select a digestible transport to select digests" /> [% ELSE %] + name="digest" class="pmp_digest active_notify" data-attr-id="[% messaging_preference.message_attribute_id | html %]" data-toggle="tooltip" title="You must select a digestible transport to select digests" /> [% END %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/messaging-preference-form.js b/koha-tmpl/intranet-tmpl/prog/js/messaging-preference-form.js index 0196d6e1b3..716019b8a0 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/messaging-preference-form.js +++ b/koha-tmpl/intranet-tmpl/prog/js/messaging-preference-form.js @@ -53,9 +53,9 @@ $(document).ready(function(){ var rowid = $(this).attr("id"); id = Number(rowid.replace("email","")); if ( $("#email"+id).prop("checked") || $("#sms"+id).prop("checked") ) { - $("#digest"+id).attr("disabled", false); + $("#digest"+id).attr("disabled", false).tooltip('disable'); } else { - $("#digest"+id).attr("disabled", true).prop("checked",false); + $("#digest"+id).attr("disabled", true).prop("checked",false).tooltip('enable'); } }); @@ -64,18 +64,20 @@ $(document).ready(function(){ var rowid = $(this).attr("id"); id = Number(rowid.replace("email","")); if ( $("#email"+id).prop("checked") || $("#sms"+id).prop("checked") ) { - $("#digest"+id).attr("disabled", false); + $("#digest"+id).attr("disabled", false).tooltip('disable'); } else { - $("#digest"+id).attr("disabled", true).prop("checked",false); + $("#digest"+id).attr("disabled", true).prop("checked",false).tooltip('enable'); } }); $(".pmp_sms").click(function(){ var rowid = $(this).attr("id"); id = Number(rowid.replace("sms","")); if ( $("#email"+id).prop("checked") || $("#sms"+id).prop("checked") ) { - $("#digest"+id).attr("disabled", false); + $("#digest"+id).attr("disabled", false).tooltip('disable'); } else { - $("#digest"+id).attr("disabled", true).prop("checked",false); + $("#digest"+id).attr("disabled", true).prop("checked",false).tooltip('enable'); } }); + +// $('#memberentry_messaging_prefs [data-toggle="tooltip"][disabled]').tooltip(); }); diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt index a27ea6aa67..568e303da2 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt @@ -155,9 +155,9 @@ [% IF ( messaging_preference.has_digest ) %] [% IF ( messaging_preference.digest ) %] - + [% ELSE %] - + [% END %] [% ELSE %] @@ -254,9 +254,9 @@ var rowid = $(this).attr("id"); id = Number(rowid.replace("email","")); if ( $("#email"+id).prop("checked") || $("#sms"+id).prop("checked") ) { - $("#digest"+id).attr("disabled", false); + $("#digest"+id).attr("disabled", false).tooltip('disable'); } else { - $("#digest"+id).attr("disabled", true); + $("#digest"+id).attr("disabled", true).tooltip('enable'); } }); @@ -265,18 +265,18 @@ var rowid = $(this).attr("id"); id = Number(rowid.replace("email","")); if ( $("#email"+id).prop("checked") || $("#sms"+id).prop("checked") ) { - $("#digest"+id).attr("disabled", false); + $("#digest"+id).attr("disabled", false).tooltip('disable'); } else { - $("#digest"+id).attr("disabled", true).prop("checked",false); + $("#digest"+id).attr("disabled", true).prop("checked",false).tooltip('enable'); } }); $(".pmp_sms").click(function(){ var rowid = $(this).attr("id"); id = Number(rowid.replace("sms","")); if ( $("#email"+id).prop("checked") || $("#sms"+id).prop("checked") ) { - $("#digest"+id).attr("disabled", false); + $("#digest"+id).attr("disabled", false).tooltip('disable'); } else { - $("#digest"+id).attr("disabled", true).prop("checked",false); + $("#digest"+id).attr("disabled", true).prop("checked",false).tooltip('enable'); } }); }); -- 2.39.5