previsualizar archivos subidos
This commit is contained in:
parent
96ddc47b77
commit
03143096ed
1 changed files with 13 additions and 0 deletions
|
@ -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),
|
||||
|
|
Loading…
Reference in a new issue