% if @comment.errors.any? %>
<%= pluralize(@comment.errors.count, "error") %> prohibited this comment from being saved:
<% @comment.errors.full_messages.each do |message| %>
- <%= message %>
<% end %>
<% end %>
<%= form_for(@comment, authenticity_token: false) do |f| %>
<% if @article&.comment_template.present? && @comment.new_record? %>
This post comes with a comment template
<% end %>
<%# this is used by JS and it will be replaced with the CSRF token received from the server %>
<% unless @comment.persisted? %>
<%= f.hidden_field :commentable_id, value: commentable.id %>
<%= f.hidden_field :commentable_type, value: commentable_type %>
<%= f.hidden_field :parent_id, value: @parent_comment.id if @parent_comment %>
<% end %>
<%= f.text_area :body_markdown,
placeholder: "Add to the discussion",
onfocus: "handleFocus(event)",
onblur: "handleBlur(event)",
onkeyup: "handleKeyUp(event)",
onkeydown: "handleKeyDown(event)",
id: "text-area",
autofocus: @comment.persisted?,
required: true,
'aria-label': "Add a comment to the discussion" %>
" />
<%= link_to(request.referer.present? ? :back : commentable.path, "aria-label": "Cancel action") do %>
<% end %>
<%= f.submit "SUBMIT", onclick: "validateField(event)", class: "comment-action-button", id: "submit-button" %>
<% end %>
<% if @comment.persisted? %>
<% end %>