Merge branch 'main' into 6624/etq-instructeur-je-souhaite-supprimer-des-messages-envoyes-par-erreur
This commit is contained in:
commit
1d174df2ec
7 changed files with 31 additions and 19 deletions
|
@ -190,10 +190,10 @@ module NewAdministrateur
|
|||
end
|
||||
|
||||
def update_routing_enabled
|
||||
procedure.update!(routing_enabled: true)
|
||||
procedure.update!(routing_enabled_params)
|
||||
|
||||
redirect_to admin_procedure_groupe_instructeurs_path(procedure),
|
||||
notice: "Le routage est activé."
|
||||
notice: "Le routage est #{procedure.routing_enabled? ? "activée" : "désactivée"}."
|
||||
end
|
||||
|
||||
def update_instructeurs_self_management_enabled
|
||||
|
@ -326,5 +326,9 @@ module NewAdministrateur
|
|||
def instructeurs_self_management_enabled_params
|
||||
params.require(:procedure).permit(:instructeurs_self_management_enabled)
|
||||
end
|
||||
|
||||
def routing_enabled_params
|
||||
{ routing_enabled: params.require(:routing) == 'enable' }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -201,7 +201,7 @@ class User < ApplicationRecord
|
|||
|
||||
def merge(old_user)
|
||||
transaction do
|
||||
old_user.dossiers.update_all(user_id: id)
|
||||
old_user.dossiers.with_discarded.update_all(user_id: id)
|
||||
old_user.invites.update_all(user_id: id)
|
||||
old_user.merge_logs.update_all(user_id: id)
|
||||
|
||||
|
|
|
@ -1,18 +1,23 @@
|
|||
.card
|
||||
.card-title Routage
|
||||
%p.notice= t('.notice_html')
|
||||
- if !procedure.routee?
|
||||
%p.notice= t('.notice_html')
|
||||
|
||||
= link_to t('.button.routing_enable'), update_routing_enabled_admin_procedure_groupe_instructeurs_path(procedure), class: 'button primary mt-1', method: 'patch'
|
||||
- if procedure.routee?
|
||||
- if procedure.routing_enabled? && procedure.groupe_instructeurs.size == 1
|
||||
= link_to t('.button.routing_disable'), update_routing_enabled_admin_procedure_groupe_instructeurs_path(procedure, routing: :disable), class: 'button primary mt-1', method: 'patch'
|
||||
- else
|
||||
= link_to t('.button.routing_enable'), update_routing_enabled_admin_procedure_groupe_instructeurs_path(procedure, routing: :enable), class: 'button primary mt-1', method: 'patch'
|
||||
|
||||
.card-title.mt-4 L‘autogestion des instructeurs
|
||||
%p.notice= t('.self_managment_notice_html')
|
||||
.card-title.mt-4 L‘autogestion des instructeurs
|
||||
%p.notice= t('.self_managment_notice_html')
|
||||
|
||||
= form_for procedure,
|
||||
method: :patch,
|
||||
url: update_instructeurs_self_management_enabled_admin_procedure_groupe_instructeurs_path(procedure),
|
||||
html: { class: 'form procedure-form__column--form no-background' } do |f|
|
||||
%label.toggle-switch
|
||||
= f.check_box :instructeurs_self_management_enabled, class: 'toggle-switch-checkbox', onchange: 'this.form.submit()'
|
||||
%span.toggle-switch-control.round
|
||||
%span.toggle-switch-label.on
|
||||
%span.toggle-switch-label.off
|
||||
= form_for procedure,
|
||||
method: :patch,
|
||||
url: update_instructeurs_self_management_enabled_admin_procedure_groupe_instructeurs_path(procedure),
|
||||
html: { class: 'form procedure-form__column--form no-background' } do |f|
|
||||
%label.toggle-switch
|
||||
= f.check_box :instructeurs_self_management_enabled, class: 'toggle-switch-checkbox', onchange: 'this.form.submit()'
|
||||
%span.toggle-switch-control.round
|
||||
%span.toggle-switch-label.on
|
||||
%span.toggle-switch-label.off
|
||||
|
|
|
@ -10,10 +10,11 @@
|
|||
'Instructeurs'] }
|
||||
|
||||
.container.groupe-instructeur
|
||||
= render partial: 'new_administrateur/groupe_instructeurs/routing', locals: { procedure: @procedure }
|
||||
|
||||
- if @procedure.routee?
|
||||
= render partial: 'new_administrateur/groupe_instructeurs/edit', locals: { procedure: @procedure, groupes_instructeurs: @groupes_instructeurs }
|
||||
- else
|
||||
= render partial: 'new_administrateur/groupe_instructeurs/routing', locals: { procedure: @procedure }
|
||||
= render partial: 'new_administrateur/groupe_instructeurs/instructeurs',
|
||||
locals: { procedure: @procedure,
|
||||
groupe_instructeur: @procedure.defaut_groupe_instructeur,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#profil-page.container
|
||||
%h1 Profil
|
||||
|
||||
- if @waiting_merge_emails.any?
|
||||
- if @waiting_merge_emails&.any?
|
||||
.card
|
||||
.card-title Demande de fusion de comptes
|
||||
%p
|
||||
|
|
|
@ -43,4 +43,5 @@ fr:
|
|||
L’autogestion des instructeurs permet aux instructeurs de gérer eux-mêmes la liste des instructeurs de la démarche.
|
||||
button:
|
||||
routing_enable: Activer le routage
|
||||
routing_disable: Désactiver le routage
|
||||
self_managment_toggle: Activer l’autogestion des instructeurs
|
||||
|
|
|
@ -426,13 +426,14 @@ describe User, type: :model do
|
|||
|
||||
context 'and the old account has some stuff' do
|
||||
let!(:dossier) { create(:dossier, user: old_user) }
|
||||
let!(:hidden_dossier) { create(:dossier, user: old_user, hidden_at: Time.zone.now) }
|
||||
let!(:invite) { create(:invite, user: old_user) }
|
||||
let!(:merge_log) { MergeLog.create(user: old_user, from_user_id: 1, from_user_email: 'a') }
|
||||
|
||||
it 'transfers the dossier' do
|
||||
subject
|
||||
|
||||
expect(targeted_user.dossiers).to match([dossier])
|
||||
expect(targeted_user.dossiers.with_discarded).to match([dossier, hidden_dossier])
|
||||
expect(targeted_user.invites).to match([invite])
|
||||
expect(targeted_user.merge_logs.first).to eq(merge_log)
|
||||
|
||||
|
|
Loading…
Reference in a new issue