2019-08-23 18:29:07 +00:00
|
|
|
.form-group
|
|
|
|
- if metadata.uploaded?
|
2019-08-22 01:09:29 +00:00
|
|
|
= image_tag url_for(metadata.static_file),
|
|
|
|
alt: metadata.value['description'],
|
|
|
|
class: 'img-fluid',
|
|
|
|
id: "#{attribute}-preview"
|
|
|
|
|
|
|
|
-#
|
|
|
|
Mantener el valor si no enviamos ninguna imagen
|
|
|
|
TODO: Agregar checkbox para eliminarla
|
|
|
|
= hidden_field_tag "post[#{attribute}][path]", metadata.value['path']
|
2019-08-13 19:09:23 +00:00
|
|
|
|
|
|
|
.custom-file
|
|
|
|
= file_field(*field_name_for('post', attribute, :path),
|
2019-08-22 01:09:29 +00:00
|
|
|
**field_options(attribute, metadata),
|
2019-08-23 18:29:07 +00:00
|
|
|
class: "custom-file-input #{invalid(post, attribute)}",
|
|
|
|
accept: 'image/*', data: { preview: "#{attribute}-preview" })
|
2019-08-13 19:09:23 +00:00
|
|
|
= 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
|
|
|
|
|
2019-08-23 18:29:07 +00:00
|
|
|
.form-group
|
2019-08-13 19:09:23 +00:00
|
|
|
= 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
|