<%= form_for post, local: true, html: { class: "row" } do |f| %> <%= render "admin/shared/errors", object: post %>
<%= f.label :title, "Título" %> <%= f.text_field :title, placeholder: "Título", autofocus: true, required: true, class: "form-control" %>
<%= f.label :category, "Categoría" %> <%= f.select :category, (Post.all.select(:category).map(&:category) + ["Nutrición", "Entrenamiento", "Suplementos Alimenticios"]).uniq, { include_blank: 'Categoría' }, { class: "selectize md-input form-control", data: { create: true }, required: true } %>
<%= image_tag (post.cover.blank? ? "" : post.cover.large.url), width: 200, id: "cover-img" %>
<%= f.file_field :cover, data: { target: "#cover-img" }, class: "input-img custom-file-input", required: post.cover.blank? %> <%= f.label :cover, "Imagen de portada 1200x630", class: "custom-file-label" %>
<%= f.label :description, "Sinopsis (110 a 300 caracteres)" %> <%= f.text_area :description, placeholder: "Sinopsis", required: true, minlength: 110, maxlength: 300, class: "form-control" %> <%= post.description.to_s.length %> caracteres
<%= f.label :body, "Contenido" %> <%= f.text_area :body, placeholder: "Contenido", class: "editor" %>
<% if f.object.persisted? %> <%= link_to t(:delete), post_path(post), class: "btn btn-danger btn-sm", method: :delete, data: { confirm: "¿Estás seguro de eliminar este #{t(:post)}?" } %> <% end %>
<% end %>