demarches-normaliennes/app/views/shared/dossiers/messages/_form.html.haml
2024-07-10 16:33:39 +02:00

20 lines
1.5 KiB
Text

= render NestedForms::FormOwnerComponent.new
= form_for(commentaire, url: form_url, html: { multipart: local_assigns.has_key?(:dossier), data: { controller: 'persisted-form', persisted_form_key_value: dom_id(local_assigns.fetch(:dossier, local_assigns.fetch(:last_commentaire, current_user))) } }) do |f|
- placeholder = t('views.shared.dossiers.messages.form.write_message_to_administration_placeholder')
- if local_assigns.has_key?(:last_commentaire)
= f.hidden_field :last_commentaire, value: last_commentaire.id, name: :id
- elsif local_assigns.has_key?(:dossier) && instructeur_signed_in? || administrateur_signed_in? || expert_signed_in?
- placeholder = t('views.shared.dossiers.messages.form.write_message_placeholder')
%p.mandatory-explanation= t('asterisk_html', scope: [:utils])
= render Dsfr::InputComponent.new(form: f, attribute: :body, input_type: :text_area, opts: { rows: 5, placeholder: placeholder, title: placeholder, class: 'fr-input message-textarea'})
- if local_assigns.has_key?(:dossier)
.fr-mt-3w.fr-input-group
= f.label :piece_jointe, class: "fr-label", for: dom_id(commentaire, :piece_jointe)
%div{ data: { controller: "file-input-reset", delete_label: t('views.shared.messages.remove_file') } }
= render Attachment::MultipleComponent.new(attached_file: commentaire.piece_jointe)
%ul{ data: { 'file-input-reset-target': 'fileList' } }
.fr-mt-3w
= f.submit t('views.shared.dossiers.messages.form.send_message'), class: 'fr-btn', data: { disable: true }