2019-08-13 19:09:23 +00:00
|
|
|
- unless post.errors.empty?
|
2018-02-02 22:20:31 +00:00
|
|
|
.alert.alert-danger
|
|
|
|
%ul
|
2019-08-13 19:09:23 +00:00
|
|
|
- post.errors.each do |key, error|
|
2018-10-31 21:55:50 +00:00
|
|
|
%li
|
2019-08-13 19:09:23 +00:00
|
|
|
%strong
|
|
|
|
= key.capitalize
|
2018-10-31 21:55:50 +00:00
|
|
|
= [error].flatten.join("\n")
|
2018-02-02 22:20:31 +00:00
|
|
|
|
2019-08-13 19:09:23 +00:00
|
|
|
-# TODO: habilitar form_for
|
|
|
|
:ruby
|
|
|
|
if post.new?
|
|
|
|
url = site_posts_path(site)
|
|
|
|
method = :post
|
|
|
|
else
|
2019-08-16 23:12:22 +00:00
|
|
|
url = site_post_path(site, post.id)
|
2019-08-13 19:09:23 +00:00
|
|
|
method = :patch
|
|
|
|
end
|
2018-12-14 15:12:17 +00:00
|
|
|
|
2019-08-13 19:09:23 +00:00
|
|
|
-# Comienza el formulario
|
|
|
|
= form_tag url, method: method, class: 'form post', multipart: true do
|
|
|
|
|
|
|
|
-# Botones de guardado
|
|
|
|
= render 'posts/submit', site: site
|
|
|
|
|
|
|
|
-# Dibuja cada atributo
|
|
|
|
- post.attributes.each do |attribute|
|
2019-08-13 23:33:57 +00:00
|
|
|
- metadata = post.send(attribute)
|
|
|
|
- type = metadata.type
|
2019-08-13 19:09:23 +00:00
|
|
|
= render "posts/attributes/#{type}",
|
|
|
|
post: post, attribute: attribute,
|
2019-08-16 23:12:22 +00:00
|
|
|
metadata: metadata, site: site
|
2019-08-13 19:09:23 +00:00
|
|
|
|
|
|
|
-# Botones de guardado
|
|
|
|
= render 'posts/submit', site: site
|