Bugzilla – Attachment 168480 Details for
Bug 31354
Clarify options for 'Change messaging preferences to default for this category?' popup
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31354: Use modal popup for messaging preferences when editing a patron's category.
Bug-31354-Use-modal-popup-for-messaging-preference.patch (text/plain), 7.13 KB, created by
Sam Lau
on 2024-07-03 22:02:57 UTC
(
hide
)
Description:
Bug 31354: Use modal popup for messaging preferences when editing a patron's category.
Filename:
MIME Type:
Creator:
Sam Lau
Created:
2024-07-03 22:02:57 UTC
Size:
7.13 KB
patch
obsolete
>From 44cb2913873847c7ea41a01e3a44a48c79c3e7e2 Mon Sep 17 00:00:00 2001 >From: Sam Lau <samalau@gmail.com> >Date: Wed, 3 Jul 2024 21:49:13 +0000 >Subject: [PATCH] Bug 31354: Use modal popup for messaging preferences when > editing a patron's category. > >To test: >1) In Administration->Patron categories, edit the 'Home Bound' category and select every messaging preferences. >2) Edit the 'Patron' category and select email for the 'Item due' messaging pref. >3) Visit a patrons page from any category except Homebound. Keep note of their messaging preferences (will probably just be none) >4) Edit this patron and change their category to 'Homebound'. You should be greeted with a modal that asks if you want to "Change messaging preferences to default for this category?". Select yes. Save changes on the edit form >5) In the details page, note the messaging preferences were set to the defualt for the Homebound category (all selected) >6) Edit patron again, this time change their category to 'Patron'. >7) When the modal pops up, select no. Save the edit form. >8) In details page, the messaging prefs should not have changed. >--- > .../prog/en/modules/members/memberentrygen.tt | 20 ++++++ > .../prog/js/messaging-preference-form.js | 65 ++++++++++--------- > 2 files changed, 55 insertions(+), 30 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >index 6877ef453f..395f13aa93 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -1752,6 +1752,26 @@ legend.collapsed i.fa.fa-caret-down::before { > </div> <!-- /.col-sm-2.col-sm-pull-10 --> > [% END %] > </div> <!-- /.row --> >+ >+ <!-- Message preferences modal form --> >+ <div id="messagePreferencesModal" class="modal" tabindex="-1" role="dialog" aria-labelledby="messagePreferencesModalLabel" aria-hidden="true"> >+ <div class="modal-dialog" role="document"> >+ <div class="modal-content"> >+ <div class="modal-header"> >+ <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> >+ <h4 class="modal-title" id="messagePreferencesModalLabel">Confirm message preferences</h4> >+ </div> >+ <div class="modal-body"> >+ <p>Change messaging preferences to default for this category?</p> >+ </div> >+ <div class="modal-footer"> >+ <button id="messagePreferencesConfirmBtn" class="btn btn-primary"><i class="fa fa-check" aria-hidden="true"></i> Yes</button> >+ <button id="messagePreferencesCancelBtn"data-dismiss="modal" class="btn btn-secondary"><i class="fa fa-times" aria-hidden="true"></i> No</button> >+ </div> >+ </div> >+ </div> >+ </div> >+ > [% MACRO jsinclude BLOCK %] > [% Asset.js("lib/hc-sticky/hc-sticky.js") | $raw %] > [% INCLUDE 'calendar.inc' %] >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 5fdc5c1917..362f88f3e4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/messaging-preference-form.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/messaging-preference-form.js >@@ -17,40 +17,45 @@ $(document).ready(function(){ > messaging_prefs_loading.show(); > var categorycode = $(this).val(); > if (message_prefs_dirty) { >- if (!confirm( __("Change messaging preferences to default for this category?") )) { >- // Not loading messaging defaults. Hide loading indicator >- messaging_prefs_loading.hide(); >- return; >- } >+ $('#messagePreferencesModal').modal('show'); >+ // Handle confirmation Yes button click >+ $('#messagePreferencesConfirmBtn').on('click', function() { >+ loadMessagingDefaults(categorycode, messaging_prefs_loading); >+ $('#messagePreferencesModal').modal('hide'); >+ }); > } >- var jqxhr = $.getJSON('/cgi-bin/koha/members/default_messageprefs.pl?categorycode=' + categorycode, function(data) { >- $.each(data.messaging_preferences, function(i, item) { >- var attrid = item.message_attribute_id; >- var transports = ['email', 'rss', 'sms']; >- $.each(transports, function(j, transport) { >- if (item['transports_' + transport] == 1) { >- $('#' + transport + attrid).prop('checked', true); >- toggle_digest(attrid); >- } else { >- $('#' + transport + attrid).prop('checked', false); >- toggle_digest(attrid); >- } >- }); >- if (item.digest && item.digest != ' ') { >- $('#digest' + attrid).prop('checked', true); >+ }); >+ } >+ >+ // Function to load messaging defaults from server >+ function loadMessagingDefaults(categorycode, loadingIndicator) { >+ var jqxhr = $.getJSON('/cgi-bin/koha/members/default_messageprefs.pl?categorycode=' + categorycode, function(data) { >+ $.each(data.messaging_preferences, function(i, item) { >+ var attrid = item.message_attribute_id; >+ var transports = ['email', 'rss', 'sms']; >+ $.each(transports, function(j, transport) { >+ if (item['transports_' + transport] == 1) { >+ $('#' + transport + attrid).prop('checked', true); >+ toggle_digest(attrid); > } else { >- $('#digest' + attrid).prop('checked', false); >+ $('#' + transport + attrid).prop('checked', false); >+ toggle_digest(attrid); > } >- if (item.takes_days == '1') { >- $('[name=' + attrid + '-DAYS]').val('' + item.days_in_advance); >- } >- }); >- message_prefs_dirty = false; >- }) >- .always(function() { >- // Loaded messaging defaults. Hide loading indicator >- messaging_prefs_loading.hide(); > }); >+ if (item.digest && item.digest != ' ') { >+ $('#digest' + attrid).prop('checked', true); >+ } else { >+ $('#digest' + attrid).prop('checked', false); >+ } >+ if (item.takes_days == '1') { >+ $('[name=' + attrid + '-DAYS]').val('' + item.days_in_advance); >+ } >+ }); >+ message_prefs_dirty = false; >+ }) >+ .always(function() { >+ // Hide loading indicator after processing >+ loadingIndicator.hide(); > }); > } > >-- >2.39.2
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 31354
:
168480
|
168482
|
168484
|
168578
|
171474
|
171905