From 5d176758fe4139f2c2bb226cdd8e9ed7b305fc4f 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 --- .../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 9340384f7c..1d508565d8 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 @@ -187,24 +187,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 a8c714950f..ef9e266d3d 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt @@ -156,9 +156,9 @@ [% IF ( messaging_preference.has_digest ) %] [% IF ( messaging_preference.digest ) %] - + [% ELSE %] - + [% END %] [% ELSE %] @@ -255,9 +255,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'); } }); @@ -266,18 +266,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