previsualizar archivos subidos

This commit is contained in:
f 2020-05-26 16:39:10 -03:00
parent 96ddc47b77
commit 03143096ed

View file

@ -2,6 +2,19 @@
- if metadata.uploaded?
= hidden_field_tag "post[#{attribute}][path]", metadata.value['path']
- case metadata.static_file.blob.content_type
- when %r{\Avideo/}
= video_tag url_for(metadata.static_file),
controls: true, class: 'img-fluid'
- when %r{\Aaudio/}
= audio_tag url_for(metadata.static_file),
controls: true, class: 'img-fluid'
- when 'application/pdf'
%iframe{ src: url_for(metadata.static_file) }
- else
= link_to t('posts.attribute_ro.file.download'),
url_for(metadata.static_file)
.custom-file
= file_field(*field_name_for('post', attribute, :path),
**field_options(attribute, metadata),