From 00f93e035a63046fd946b84de66a25ae21009220 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 1 Sep 2020 18:49:01 -0300 Subject: [PATCH] previsualizar archivos --- app/views/posts/attribute_ro/_file.haml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/views/posts/attribute_ro/_file.haml b/app/views/posts/attribute_ro/_file.haml index 7d51156b..0b4e09d1 100644 --- a/app/views/posts/attribute_ro/_file.haml +++ b/app/views/posts/attribute_ro/_file.haml @@ -2,5 +2,16 @@ %th= post_label_t(attribute, :path, post: post) %td - if metadata.value['path'].present? - = link_to t('.download'), url_for(metadata.static_file) + - 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('.download'), + url_for(metadata.static_file) %p{ dir: dir, lang: locale }= metadata.value['description']