mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-28 20:26:22 +00:00
35 lines
868 B
Text
35 lines
868 B
Text
- unless post.errors.empty?
|
|
.alert.alert-danger
|
|
%h4= t('.errors.title')
|
|
%p= t('.errors.help')
|
|
|
|
-# TODO: habilitar form_for
|
|
:ruby
|
|
if post.new?
|
|
url = site_posts_path(site)
|
|
method = :post
|
|
else
|
|
url = site_post_path(site, post.id)
|
|
method = :patch
|
|
end
|
|
|
|
-# Comienza el formulario
|
|
= form_tag url, method: method, class: 'form post', multipart: true do
|
|
|
|
-# Botones de guardado
|
|
= render 'posts/submit', site: site, post: post
|
|
|
|
-# Dibuja cada atributo
|
|
- post.attributes.each do |attribute|
|
|
-# El borrador se muestra distinto
|
|
- next if attribute == :draft
|
|
|
|
- metadata = post.send(attribute)
|
|
- type = metadata.type
|
|
|
|
= render("posts/attributes/#{type}",
|
|
post: post, attribute: attribute,
|
|
metadata: metadata, site: site)
|
|
|
|
-# Botones de guardado
|
|
= render 'posts/submit', site: site, post: post
|