Merge pull request #2910 from tchak/demarche-en-test-banner

Show warning on dossier pages when procedure is brouillon
This commit is contained in:
Paul Chavard 2018-10-25 19:42:24 +02:00 committed by GitHub
commit 7934294e3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,6 +10,7 @@ module NewUser
before_action :ensure_dossier_can_be_updated, only: [:update_identite, :update_brouillon, :modifier, :update]
before_action :forbid_invite_submission!, only: [:update_brouillon]
before_action :forbid_closed_submission!, only: [:update_brouillon]
before_action :show_demarche_en_test_banner
def index
@user_dossiers = current_user.dossiers.includes(:procedure).order_by_updated_at.page(page)
@ -211,6 +212,12 @@ module NewUser
private
def show_demarche_en_test_banner
if @dossier.present? && @dossier.procedure.brouillon?
flash.now.notice = "Ce dossier est déposé sur une démarche en test. Il sera supprimé lors de la publication de la démarche."
end
end
def ensure_dossier_can_be_updated
if !dossier.can_be_updated_by_the_user?
flash.alert = 'Votre dossier ne peut plus être modifié'