%= form_for @support_thread,
url: (@support_thread.persisted? ? help_center.support_thread_path(@support_thread) : help_center.support_threads_path),
html: { data: {behavior: "comment-form"} } do |f| %>
<% if @support_thread.errors.any? %>
<%= pluralize(@support_thread.errors.count, "error") %> prohibited this support_thread from being saved:
<% @support_thread.errors.full_messages.each do |message| %>
- <%= message %>
<% end %>
<% end %>
<%= f.label :support_category_id, t('choose_a_category') %>
<%= f.collection_select :support_category_id, SupportCategory.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" %>
<%= f.label t('position') %>
<%= f.text_field :position, class: "form-control" %>
<%= f.label t('content') %>
<%= f.rich_text_area :content %>
<% if local_assigns.fetch(:posts, true) %>
<% if !f.object.new_record? %>
<%= f.fields_for :support_posts do |p| %>
<%= p.label :body, t('what_help_needed') %>
<%= p.text_area :body, placeholder: t('add_a_comment'), rows: 10, class: "form-control simplemde", data: { behavior: "comment-body" } %>
<% end %>
<% end %>
<% end %>
<% if f.object.new_record? %>
<%= f.button t('add'), class: "btn btn-primary", data: {disable_with: " #{t('saving')}"} %>
<% else %>
<%= f.button t('update'), class: "btn btn-primary", data: {disable_with: " #{t('saving')}"} %>
<% end %>
<% end %>