demarches-normaliennes/app/views/commencer/show.html.haml
2019-01-21 14:45:38 +01:00

30 lines
1.6 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

- content_for(:title, @procedure.libelle)
.commencer.form
- if !user_signed_in?
%h1 Commencer la démarche
= link_to 'Créer un compte demarches-simplifiees.fr', commencer_sign_up_path(path: @procedure.path), class: ['button large expand primary']
= link_to 'Jai déjà un compte', commencer_sign_in_path(path: @procedure.path), class: ['button large expand']
- else
- dossiers = current_user.dossiers.where(procedure: @procedure)
- drafts = dossiers.merge(Dossier.state_brouillon)
- not_drafts = dossiers.merge(Dossier.state_not_brouillon)
- if dossiers.count == 0
= link_to 'Commencer la démarche', url_for_new_dossier(@procedure), class: ['button large expand primary']
- elsif drafts.count == 1 && not_drafts.count == 0
%h1 Vous avez déjà commencé à remplir un dossier
= link_to 'Continuer à remplir mon dossier', brouillon_dossier_path(drafts.first), class: ['button large expand primary']
= link_to 'Commencer un nouveau dossier', url_for_new_dossier(@procedure), class: ['button large expand']
- elsif not_drafts.count == 1
%h1 Vous avez déjà déposé un dossier
= link_to 'Voir mon dossier', dossier_path(not_drafts.first), class: ['button large expand primary']
= link_to 'Commencer un nouveau dossier', url_for_new_dossier(@procedure), class: ['button large expand']
- else
%h1 Vous avez déjà des dossiers pour cette démarche
= link_to 'Voir mes dossiers en cours', dossiers_path, class: ['button large expand primary']
= link_to 'Commencer un nouveau dossier', url_for_new_dossier(@procedure), class: ['button large expand']