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),