%= form_for @forum_thread,
url: (@forum_thread.persisted? ? simple_discussion.forum_thread_path(@forum_thread) : simple_discussion.forum_threads_path),
html: { data: {behavior: "comment-form"} } do |f| %>
<% if @forum_thread.errors.any? %>
<%= pluralize(@forum_thread.errors.count, "error") %> prohibited this forum_thread from being saved:
<% @forum_thread.errors.full_messages.each do |message| %>
- <%= message %>
<% end %>
<% end %>
<%= f.label :forum_category_id, t('choose_a_category') %>
<%= f.collection_select :forum_category_id, ForumCategory.sorted, :id, :name, {include_blank: t('pick_a_category')}, {autofocus: true, class: "form-control"} %>
<%= f.label t('title') %>
<%= f.text_field :title, placeholder: t('how_do_i'), class: "form-control" %>
<% if local_assigns.fetch(:posts, true) %>
<%= f.fields_for :forum_posts do |p| %>
<%= p.label :body, "What do you need help with?" %>
<%= p.text_area :body, placeholder: t('add_a_comment'), rows: 10, class: "form-control simplemde", data: { behavior: "comment-body" } %>
<% end %>
<% end %>
<% if f.object.new_record? %>
<%= f.button "Ask Your Question", class: "btn btn-primary", data: {disable_with: " #{t('saving')}"} %>
<% else %>
<%= f.button "Update Thread", class: "btn btn-primary", data: {disable_with: " #{t('saving')}"} %>
<% end %>
<% end %>