Bugzilla – Attachment 120838 Details for
Bug 13613
Don't allow digest to be selected without a digest-able transport selected
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13613: Move similar JS code to a function
Bug-13613-Move-similar-JS-code-to-a-function.patch (text/plain), 5.21 KB, created by
Jonathan Druart
on 2021-05-11 13:13:54 UTC
(
hide
)
Description:
Bug 13613: Move similar JS code to a function
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-05-11 13:13:54 UTC
Size:
5.21 KB
patch
obsolete
>From a3946766c2cfbd60427fec20749dfb9226be3479 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 10 May 2021 11:52:12 +0200 >Subject: [PATCH] Bug 13613: Move similar JS code to a function > >--- > .../prog/js/messaging-preference-form.js | 26 +++++------------ > .../bootstrap/en/modules/opac-messaging.tt | 29 +++++++------------ > 2 files changed, 18 insertions(+), 37 deletions(-) > >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 716019b8a0f..3babbbd1f2c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/messaging-preference-form.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/messaging-preference-form.js >@@ -48,35 +48,25 @@ $(document).ready(function(){ > }); > } > >- // At load time, we want digest disabled if no digest using transport is enabled >- $(".pmp_email").each(function(){ >- var rowid = $(this).attr("id"); >- id = Number(rowid.replace("email","")); >+ function toggle_digest(id){ > if ( $("#email"+id).prop("checked") || $("#sms"+id).prop("checked") ) { > $("#digest"+id).attr("disabled", false).tooltip('disable'); > } else { > $("#digest"+id).attr("disabled", true).prop("checked",false).tooltip('enable'); > } >+ >+ } >+ // At load time, we want digest disabled if no digest using transport is enabled >+ $(".pmp_email").each(function(){ >+ toggle_digest(Number($(this).attr("id").replace("email", ""))); > }); > > // If user clears all digest using transports for a notice, disable digest checkbox > $(".pmp_email").click(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).tooltip('disable'); >- } else { >- $("#digest"+id).attr("disabled", true).prop("checked",false).tooltip('enable'); >- } >+ toggle_digest(Number($(this).attr("id").replace("email", ""))); > }); > $(".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).tooltip('disable'); >- } else { >- $("#digest"+id).attr("disabled", true).prop("checked",false).tooltip('enable'); >- } >+ toggle_digest(Number($(this).attr("id").replace("sms", ""))); > }); > > // $('#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 ef9e266d3d1..a870c35f8bc 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt >@@ -250,36 +250,27 @@ > $(document).ready(function(){ > $("#info_digests").tooltip(); > >- // At load time, we want digest disabled if no digest using transport is enabled >- $(".pmp_email").each(function(){ >- var rowid = $(this).attr("id"); >- id = Number(rowid.replace("email","")); >+ function toggle_digest(id){ > if ( $("#email"+id).prop("checked") || $("#sms"+id).prop("checked") ) { > $("#digest"+id).attr("disabled", false).tooltip('disable'); > } else { >- $("#digest"+id).attr("disabled", true).tooltip('enable'); >+ $("#digest"+id).attr("disabled", true).prop("checked",false).tooltip('enable'); > } >+ >+ } >+ // At load time, we want digest disabled if no digest using transport is enabled >+ $(".pmp_email").each(function(){ >+ toggle_digest(Number($(this).attr("id").replace("email", ""))); > }); > > // If user clears all digest using transports for a notice, disable digest checkbox > $(".pmp_email").click(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).tooltip('disable'); >- } else { >- $("#digest"+id).attr("disabled", true).prop("checked",false).tooltip('enable'); >- } >+ toggle_digest(Number($(this).attr("id").replace("email", ""))); > }); > $(".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).tooltip('disable'); >- } else { >- $("#digest"+id).attr("disabled", true).prop("checked",false).tooltip('enable'); >- } >+ toggle_digest(Number($(this).attr("id").replace("sms", ""))); > }); >+ > }); > > function normalizeSMS(value){ >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 13613
:
35471
|
118379
|
118380
|
118381
|
118648
|
118742
|
119331
|
119332
|
119333
|
120081
|
120737
|
120738
|
120739
|
120740
|
120760
| 120838