From 03143096ed7d6fdeb24919da60dfbc2d84292585 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 26 May 2020 16:39:10 -0300 Subject: [PATCH] previsualizar archivos subidos --- app/views/posts/attributes/_file.haml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/views/posts/attributes/_file.haml b/app/views/posts/attributes/_file.haml index 3da9a4e4..2d857d3e 100644 --- a/app/views/posts/attributes/_file.haml +++ b/app/views/posts/attributes/_file.haml @@ -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),