sutty/app/views/posts/attributes/_image.haml

21 lines
946 B
Plaintext
Raw Normal View History

.form-group{ class: invalid(post, attribute) }
- if metadata.value['path'].present?
= image_tag metadata.value[:path], alt: metadata.value['description']
.custom-file
= file_field(*field_name_for('post', attribute, :path),
**field_options(attribute, metadata), class: 'custom-file-input')
= 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{ class: invalid(post, attribute) }
= label_tag "post_#{attribute}_description",
post_label_t(attribute, :description, post: post)
= text_field(*field_name_for('post', attribute, :description),
value: metadata.value['description'],
**field_options(attribute, metadata))
= render 'posts/attribute_feedback',
post: post, attribute: [attribute, :description], metadata: metadata