5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-15 08:31:42 +00:00
panel/app/views/posts/attributes/_file.haml

37 lines
1.4 KiB
Text
Raw Normal View History

2019-11-07 16:08:14 +00:00
.form-group
- if metadata.uploaded?
= hidden_field_tag "post[#{attribute}][path]", metadata.value['path']
2020-05-26 19:39:10 +00:00
- 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)
2019-11-07 16:08:14 +00:00
.custom-file
= file_field(*field_name_for('post', attribute, :path),
**field_options(attribute, metadata),
class: "custom-file-input #{invalid(post, attribute)}",
data: { preview: "#{attribute}-preview" })
= label_tag "post_#{attribute}_path",
post_label_t(attribute, :path, post: post), class: 'custom-file-label'
= render 'posts/attribute_feedback',
post: post, attribute: [attribute, :path], metadata: metadata
.form-group
= label_tag "post_#{attribute}_description",
post_label_t(attribute, :description, post: post)
= text_field(*field_name_for('post', attribute, :description),
value: metadata.value['description'],
dir: dir, lang: locale,
2019-11-07 16:08:14 +00:00
**field_options(attribute, metadata))
= render 'posts/attribute_feedback',
post: post, attribute: [attribute, :description], metadata: metadata