Handle upload file size limit in UI

This commit is contained in:
Guillaume Lazzara 2016-02-18 15:46:59 +01:00
parent 534e041e1b
commit a643f34621
7 changed files with 90 additions and 9 deletions

View file

@ -59,15 +59,15 @@
- if @procedure.cerfa_flag
%tr
%th{class:'col-lg-6'}
='Formulaire (.pdf / .doc)'
='Formulaire (.pdf / .doc / .docx / .xls / .xlsx)'
%td{class:'col-lg-5'}
-if @dossier.cerfa_available?
%span.btn.btn-sm.btn-file.btn-success
Modifier
%input{type: 'file', name:'cerfa_pdf', id:'cerfa_pdf', accept: ".pdf"}
%input{type: 'file', name:'cerfa_pdf', id:'cerfa_pdf', accept: "application/pdf", :max_file_size => 3.megabytes }
-else
%input{type: 'file', name:'cerfa_pdf', id:'cerfa_pdf', accept: ".pdf"}
%input{type: 'file', name:'cerfa_pdf', id:'cerfa_pdf', accept: "application/pdf", :max_file_size => 3.megabytes }
- @dossier.pieces_justificatives.each do |piece_justificative|
%tr
@ -78,11 +78,11 @@
%span.text-success{ id: "piece_justificative_#{piece_justificative.type}" } Nous l'avons récupéré pour vous.
-else
-if piece_justificative.empty?
= file_field_tag "piece_justificative_#{piece_justificative.type}", accept: '.pdf'
= file_field_tag "piece_justificative_#{piece_justificative.type}", accept: 'application/pdf', :max_file_size => 3.megabytes
-else
%span.btn.btn-sm.btn-file.btn-success
Modifier
= file_field_tag "piece_justificative_#{piece_justificative.type}", accept: '.pdf'
= file_field_tag "piece_justificative_#{piece_justificative.type}", accept: 'application/pdf', :max_file_size => 3.megabytes
%div{style: 'text-align:right'}
%h6 Tous les champs portant un * sont obligatoires.