demarches-normaliennes/app/views/shared/dossiers/_edit.html.haml
gregoirenovel 9c6a66ae75 Change the route for DossierController#modifier
If we submit the form, and there’s an error, the
URL would be `/dossiers/:id`, therefore
`dossier_path(dossier)`, so the Résumé tab would
be active, not the messagerie tab. This change
prevents this behaviour.
2018-09-07 11:30:00 +02:00

99 lines
4 KiB
Text
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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.

.container
= render partial: "shared/dossiers/submit_is_over", locals: { dossier: dossier }
- if apercu
- form_options = { url: '', method: :get, html: { class: 'form', multipart: true } }
- elsif dossier.brouillon?
- form_options = { url: brouillon_dossier_url(dossier), method: :patch, html: { class: 'form', multipart: true } }
- else
- form_options = { url: modifier_dossier_url(dossier), method: :patch, html: { class: 'form', multipart: true } }
= form_for dossier, form_options do |f|
.prologue
.mandatory-explanation
Les champs avec un astérisque (
%span.mandatory> *
) sont obligatoires.
- if notice_url(dossier.procedure).present?
= link_to notice_url(dossier.procedure), class: 'button notice', title: "Pour vous aider à remplir votre dossier, vous pouvez consulter le guide de cette démarche." do
%span.icon.info>
Guide de la démarche
%hr
= f.fields_for :champs, dossier.champs do |champ_form|
- champ = champ_form.object
= render partial: "shared/dossiers/editable_champs/editable_champ",
locals: { champ: champ, form: champ_form }
- tpjs = dossier.types_de_piece_justificative.order('order_place ASC')
- if tpjs.present?
.card.featured
.card-title
Pièces jointes
.warning
Pour éviter toute erreur, nous vous conseillons de limiter la taille de chaque pièce jointe à 20 Mo, et de les ajouter une par une, en enregistrant votre
= dossier.brouillon? ? "brouillon" : "dossier"
après chaque ajout.
- tpjs.each do |tpj|
.pj-input
%label{ for: "piece_justificative_#{tpj.id}" }
= tpj.libelle
- if tpj.mandatory?
%span.mandatory *
%p.piece-description= tpj.description
- if tpj.lien_demarche.present?
%p.piece-description
Récupérer le formulaire vierge pour mon dossier :
= link_to "Télécharger", tpj.lien_demarche, target: :blank
- if dossier.was_piece_justificative_uploaded_for_type_id?(tpj.id)
- pj = dossier.retrieve_last_piece_justificative_by_type(tpj.id)
%p
Pièce jointe déjà importée :
= link_to pj.original_filename, pj.content_url, target: :blank
= file_field_tag "piece_justificative_#{tpj.id}",
accept: PieceJustificative.accept_format,
max_file_size: 6.megabytes,
required: (tpj.mandatory? && !dossier.was_piece_justificative_uploaded_for_type_id?(tpj.id))
- if !apercu
.send-wrapper
- if dossier.brouillon?
- if current_user.owns?(dossier)
= link_to ask_deletion_dossier_path(dossier),
method: :post,
class: 'button danger',
data: { disable: true, confirm: 'En continuant, vous allez supprimer ce dossier ainsi que les informations quil contient. Toute suppression entraine lannulation de la démarche en cours.\n\nConfirmer la suppression ?' } do
Supprimer le brouillon
= f.button 'Enregistrer le brouillon',
formnovalidate: true,
name: :save_draft,
value: true,
class: 'button send secondary',
data: { disable: true }
- if dossier.can_transition_to_en_construction?
= f.button 'Soumettre le dossier',
class: 'button send primary',
disabled: !current_user.owns?(dossier),
data: { disable: true }
- else
= f.button 'Enregistrer les modifications du dossier',
class: 'button send primary',
data: { disable: true }
- if dossier.brouillon? && !current_user.owns?(dossier)
.send-notice.invite-cannot-submit
En tant quinvité, vous pouvez remplir ce formulaire mais le titulaire du dossier doit le soumettre lui-même.
= render partial: "shared/dossiers/submit_is_over", locals: { dossier: dossier }