<%= 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:

<% end %>
<%= f.label :forum_category_id, "Choose a Category" %> <%= f.collection_select :forum_category_id, ForumCategory.sorted, :id, :name, {include_blank: "Pick a category..."}, {autofocus: true, class: "form-control"} %>
<%= f.label :title %> <%= f.text_field :title, placeholder: "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: "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: " Saving..."} %> <% else %> <%= f.button "Update Thread", class: "btn btn-primary", data: {disable_with: " Saving..."} %> <% end %>
<% end %>