Sha256: 9e9b85fb68436c7c21fdad2a6c94bebb3f234b8cec5de67b4462b9f0b225eda4

Contents?: true

Size: 1.69 KB

Versions: 6

Compression:

Stored size: 1.69 KB

Contents

<%= 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? %>
    <div id="error_explanation">
      <h2><%= pluralize(@forum_thread.errors.count, "error") %> prohibited this forum_thread from being saved:</h2>

      <ul>
      <% @forum_thread.errors.full_messages.each do |message| %>
        <li><%= message %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="form-group">
    <%= 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"} %>
  </div>

  <div class="form-group">
    <%= f.label :title %>
    <%= f.text_field :title, placeholder: "How do I...?", class: "form-control" %>
  </div>

  <% if local_assigns.fetch(:posts, true) %>
    <%= f.fields_for :forum_posts do |p| %>
      <div class="form-group">
        <%= 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" } %>
      </div>
    <% end %>
  <% end %>

  <div class="form-group text-right">
    <% if f.object.new_record? %>
      <%= f.button "Ask Your Question", class: "btn btn-primary", data: {disable_with: "<i class='fa fa-spinner fa-spin'></i> Saving..."} %>
    <% else %>
      <%= f.button "Update Thread", class: "btn btn-primary", data: {disable_with: "<i class='fa fa-spinner fa-spin'></i> Saving..."} %>
    <% end %>
  </div>

<% end %>

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
simple_discussion-0.9.5 app/views/simple_discussion/forum_threads/_form.html.erb
simple_discussion-0.9.4 app/views/simple_discussion/forum_threads/_form.html.erb
simple_discussion-0.9.3 app/views/simple_discussion/forum_threads/_form.html.erb
simple_discussion-0.9.2 app/views/simple_discussion/forum_threads/_form.html.erb
simple_discussion-0.9.1 app/views/simple_discussion/forum_threads/_form.html.erb
simple_discussion-0.9.0 app/views/simple_discussion/forum_threads/_form.html.erb