Add the possibility to disable weekly email notifications (instructeur) && rename the column email_notifications_enabled to daily_email_notification_enabled
This commit is contained in:
parent
35b608fb7d
commit
0b8a59d5e9
6 changed files with 33 additions and 8 deletions
|
@ -231,8 +231,7 @@ module Instructeurs
|
|||
end
|
||||
|
||||
def update_email_notifications
|
||||
assign_to.update!(email_notifications_enabled: params[:assign_to][:email_notifications_enabled])
|
||||
|
||||
assign_to.update!(assign_to_params)
|
||||
flash.notice = 'Vos notifications sont enregistrées.'
|
||||
redirect_to instructeur_procedure_path(procedure)
|
||||
end
|
||||
|
@ -246,6 +245,10 @@ module Instructeurs
|
|||
|
||||
private
|
||||
|
||||
def assign_to_params
|
||||
params.require(:assign_to).permit(:email_notifications_enabled, :weekly_email_notifications_enabled)
|
||||
end
|
||||
|
||||
def assign_exports
|
||||
groupe_instructeurs_for_procedure = current_instructeur.groupe_instructeurs.where(procedure: procedure)
|
||||
@xlsx_export = Export.find_for_format_and_groupe_instructeurs(:xlsx, groupe_instructeurs_for_procedure)
|
||||
|
|
|
@ -75,11 +75,12 @@ class Instructeur < ApplicationRecord
|
|||
start_date = Time.zone.now.beginning_of_week
|
||||
|
||||
active_procedure_overviews = procedures
|
||||
.where(assign_tos: { weekly_email_notifications_enabled: true })
|
||||
.publiees
|
||||
.map { |procedure| procedure.procedure_overview(start_date, groupe_instructeurs) }
|
||||
.filter(&:had_some_activities?)
|
||||
|
||||
if active_procedure_overviews.count == 0
|
||||
if active_procedure_overviews.empty?
|
||||
nil
|
||||
else
|
||||
{
|
||||
|
|
|
@ -27,18 +27,18 @@
|
|||
= form.radio_button :email_notifications_enabled, false
|
||||
Non
|
||||
|
||||
= form.label nil, "Recevoir un récapitulatif hebdomadaire"
|
||||
= form.label :email_notification, "Recevoir un récapitulatif hebdomadaire"
|
||||
%p.notice
|
||||
Cet email récapitule l’activité de la semaine sur l’ensemble de vos démarches.
|
||||
%p.notice
|
||||
Il est envoyé chaque semaine le lundi matin, et n’est pas désactivable.
|
||||
Il est envoyé chaque semaine le lundi matin.
|
||||
|
||||
.radios
|
||||
%label
|
||||
= radio_button_tag "not_implemented", "Oui", true, disabled: true
|
||||
= form.radio_button :weekly_email_notifications_enabled, true
|
||||
Oui
|
||||
%label
|
||||
= radio_button_tag "not_implemented", "Non", false, disabled: true
|
||||
= form.radio_button :weekly_email_notifications_enabled, false
|
||||
Non
|
||||
|
||||
.send-wrapper
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue