controllers
This commit is contained in:
parent
ba8d78bd97
commit
74e4e2a1ce
2 changed files with 15 additions and 1 deletions
|
@ -3,7 +3,7 @@ module Administrateurs
|
|||
layout 'all', only: [:all, :administrateurs]
|
||||
respond_to :html, :xlsx
|
||||
|
||||
before_action :retrieve_procedure, only: [:champs, :annotations, :modifications, :edit, :zones, :monavis, :update_monavis, :jeton, :update_jeton, :publication, :publish, :transfert, :close, :allow_expert_review, :experts_require_administrateur_invitation, :reset_draft]
|
||||
before_action :retrieve_procedure, only: [:champs, :annotations, :modifications, :edit, :zones, :monavis, :update_monavis, :jeton, :update_jeton, :publication, :publish, :transfert, :close, :allow_expert_review, :allow_expert_messaging, :experts_require_administrateur_invitation, :reset_draft]
|
||||
before_action :draft_valid?, only: [:apercu]
|
||||
after_action :reset_procedure, only: [:update]
|
||||
|
||||
|
@ -324,6 +324,12 @@ module Administrateurs
|
|||
redirect_to admin_procedure_experts_path(@procedure)
|
||||
end
|
||||
|
||||
def allow_expert_messaging
|
||||
@procedure.update!(allow_expert_messaging: !@procedure.allow_expert_messaging)
|
||||
flash.notice = @procedure.allow_expert_messaging ? "Les experts ont accès à la messagerie" : "Les experts n'ont plus accès à la messagerie"
|
||||
redirect_to admin_procedure_experts_path(@procedure)
|
||||
end
|
||||
|
||||
def transfer
|
||||
admin = Administrateur.by_email(params[:email_admin].downcase)
|
||||
if admin.nil?
|
||||
|
|
|
@ -7,6 +7,7 @@ module Experts
|
|||
before_action :check_if_avis_revoked, except: [:index, :procedure]
|
||||
before_action :redirect_if_no_sign_up_needed, only: [:sign_up, :update_expert]
|
||||
before_action :set_avis_and_dossier, only: [:show, :instruction, :avis_list, :avis_new, :messagerie, :create_commentaire, :delete_commentaire, :update, :telecharger_pjs]
|
||||
before_action :check_messaging_allowed, only: [:messagerie, :create_commentaire]
|
||||
|
||||
A_DONNER_STATUS = 'a-donner'
|
||||
DONNES_STATUS = 'donnes'
|
||||
|
@ -155,6 +156,13 @@ module Experts
|
|||
|
||||
private
|
||||
|
||||
def check_messaging_allowed
|
||||
if !@avis.procedure.allow_expert_messaging
|
||||
flash[:alert] = "Vous n'êtes pas autorisé à acceder à la messagerie"
|
||||
redirect_to expert_avis_url(avis.procedure, avis)
|
||||
end
|
||||
end
|
||||
|
||||
def redirect_if_no_sign_up_needed
|
||||
avis = Avis.find(params[:id])
|
||||
|
||||
|
|
Loading…
Reference in a new issue