2019-08-13 19:09:23 +00:00
|
|
|
- unless post.errors.empty?
|
2018-02-02 22:20:31 +00:00
|
|
|
.alert.alert-danger
|
2019-08-23 18:29:07 +00:00
|
|
|
%h4= t('.errors.title')
|
|
|
|
%p= t('.errors.help')
|
2018-02-02 22:20:31 +00:00
|
|
|
|
2019-08-13 19:09:23 +00:00
|
|
|
-# TODO: habilitar form_for
|
|
|
|
:ruby
|
|
|
|
if post.new?
|
2020-05-26 22:02:52 +00:00
|
|
|
url = site_posts_path(site, locale: @locale)
|
2019-08-13 19:09:23 +00:00
|
|
|
method = :post
|
|
|
|
else
|
2020-05-26 22:02:52 +00:00
|
|
|
url = site_post_path(site, post.id, locale: @locale)
|
2019-08-13 19:09:23 +00:00
|
|
|
method = :patch
|
|
|
|
end
|
2018-12-14 15:12:17 +00:00
|
|
|
|
2020-05-23 19:34:45 +00:00
|
|
|
- dir = t("locales.#{@locale}.dir")
|
|
|
|
|
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
|
2019-08-20 22:11:10 +00:00
|
|
|
= render 'posts/submit', site: site, post: post
|
2019-08-13 19:09:23 +00:00
|
|
|
|
2020-04-06 22:21:14 +00:00
|
|
|
= hidden_field_tag 'post[layout]', post.layout.name
|
2019-11-15 16:35:27 +00:00
|
|
|
|
2019-08-13 19:09:23 +00:00
|
|
|
-# Dibuja cada atributo
|
2019-08-23 18:29:07 +00:00
|
|
|
- post.attributes.each do |attribute|
|
|
|
|
- metadata = post.send(attribute)
|
|
|
|
- type = metadata.type
|
2019-08-20 22:11:10 +00:00
|
|
|
|
2019-08-23 18:29:07 +00:00
|
|
|
= render("posts/attributes/#{type}",
|
|
|
|
post: post, attribute: attribute,
|
2019-09-12 18:11:39 +00:00
|
|
|
metadata: metadata, site: site,
|
2020-05-23 19:34:45 +00:00
|
|
|
dir: dir, locale: @locale,
|
2019-09-12 18:11:39 +00:00
|
|
|
autofocus: (post.attributes.first == attribute))
|
2019-08-13 19:09:23 +00:00
|
|
|
|
|
|
|
-# Botones de guardado
|
2019-08-20 22:11:10 +00:00
|
|
|
= render 'posts/submit', site: site, post: post
|