Sha256: f41c77a64cdf7a76bd15badc6d683472f61b2f4347018edab7f7baa6fbe7c8a4

Contents?: true

Size: 1.93 KB

Versions: 5

Compression:

Stored size: 1.93 KB

Contents

<%= 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? %>
    <div id="error_explanation">
      <h2><%= pluralize(@support_thread.errors.count, "error") %> prohibited this support_thread from being saved:</h2>
      <ul>
      <% @support_thread.errors.full_messages.each do |message| %>
        <li><%= message %></li>
      <% end %>
      </ul>
    </div>
  <% end %>
  <div class="mb-4">
    <%= 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"} %>
  </div>
  <div class="mb-4">
    <%= f.label t('title') %>
    <%= f.text_field :title, placeholder: t('how_do_i'), class: "form-control" %>
  </div>
  <div class="mb-4">
    <%= f.label t('position') %>
    <%= f.text_field :position, class: "form-control" %>
  </div>
  <div class="mb-4">
    <%= f.label t('content')  %>
    <%= f.rich_text_area :content %>
  </div>
  <% if local_assigns.fetch(:posts, true) %>
  <% if !f.object.new_record? %>
    <%= f.fields_for :support_posts do |p| %>
      <div class="mb-4">
        <%= 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" } %>
      </div>
    <% end %>
    <% end %>
  <% end %>
  <div class="mb-4 text-right">
    <% if f.object.new_record? %>
      <%= f.button t('add'), class: "btn btn-primary", data: {disable_with: "<i class='fa fa-spinner fa-spin'></i> #{t('saving')}"} %>
    <% else %>
      <%= f.button t('update'), class: "btn btn-primary", data: {disable_with: "<i class='fa fa-spinner fa-spin'></i> #{t('saving')}"} %>
    <% end %>
  </div>
<% end %>

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
help_center-0.1.0 app/views/help_center/support_posts/_form.html.erb
help_center-0.0.9 app/views/help_center/support_posts/_form.html.erb
help_center-0.0.8 app/views/help_center/support_posts/_form.html.erb
help_center-0.0.7 app/views/help_center/support_posts/_form.html.erb
help_center-0.0.6 app/views/help_center/support_posts/_form.html.erb