lujanfernaud/prevy

View on GitHub
app/views/groups/topics/comments/_form.html.erb

Summary

Maintainability
Test Coverage
<%= form_for comment, url: comment_path(origin: params[:origin]) do |f| %>
  <%= render "error_messages", object: comment %>

  <div class="form-group box p-4 mt-2rem mb-2rem">
    <div class="form-group mb-0">
      <%= f.hidden_field :body, required: true %>
      <trix-editor input="topic_comment_body" class="form-control">
      </trix-editor>
    </div>
  </div>

  <% if action_name == "edit" %>
    <div class="form-group box p-4 mb-2rem">
      <h3 class="mb-4">Danger zone</h3>

      <div class="form-group mb-0">
        <p class="font-italic mb-4">
          This action is not reversible.
        </p>
        <%= link_to "Delete comment",
          comment_path(comment, origin: params[:origin]), method: :delete,
          data: { confirm: "Are you sure you want to delete this comment?" },
          class: "btn btn-danger btn-lg" %>
      </div>
    </div>
  <% end %>

  <%= f.submit yield(:button_text),
    class: "btn btn-primary btn-block btn-lg btn-3d mt-4 mb-4" %>
<% end %>