- unless post.errors.empty? - title = t('.errors.title') - help = t('.errors.help') = render 'bootstrap/alert' do %h4= title %p= help %ul - post.errors.each do |attribute, errors| - if errors.size > 1 %li %strong= post_label_t attribute, post: post %ul - errors.each do |error| %li= error - else %li %strong= post_label_t attribute, post: post = errors.first -# TODO: habilitar form_for :ruby if post.new? url = site_posts_path(site, locale: @locale) method = :post extra_class = 'new' else url = site_post_path(site, post.id, locale: @locale) method = :patch extra_class = 'edit' end - dir = t("locales.#{@locale}.dir") -# Comienza el formulario = form_tag url, method: method, class: "form post #{extra_class}", multipart: true, data: { controller: 'unsaved-changes form-validation', action: 'unsaved-changes#submit form-validation#submit beforeunload@window->unsaved-changes#unsaved turbolinks:before-visit@window->unsaved-changes#unsavedTurbolinks', 'unsaved-changes-confirm-value': t('.confirm') } do -# Botones de guardado = render 'posts/submit', site: site, post: post = hidden_field_tag 'post[layout]', post.layout.name -# Dibuja cada atributo = render 'posts/attributes', site: site, post: post, dir: dir, base: 'post', locale: @locale -# Botones de guardado = render 'posts/submit', site: site, post: post -# Formularios usados por los modales = yield(:post_form)