5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-15 06:31:44 +00:00
panel/app/views/posts/_form.haml

36 lines
832 B
Text
Raw Normal View History

- unless post.errors.empty?
2018-02-02 22:20:31 +00:00
.alert.alert-danger
%ul
- post.errors.each do |key, error|
%li
%strong
= key.capitalize
= [error].flatten.join("\n")
2018-02-02 22:20:31 +00:00
-# TODO: habilitar form_for
:ruby
if post.new?
url = site_posts_path(site)
method = :post
else
url = site_post_path(site, post)
method = :patch
end
2018-12-14 15:12:17 +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
= render "posts/attributes/#{type}",
post: post, attribute: attribute,
2019-08-13 23:33:57 +00:00
metadata: metadata
-# Botones de guardado
= render 'posts/submit', site: site