<%= javascript_packs_with_chunks_tag "validateFileInputs", "responseTemplates", defer: true %>
<% 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, html: { class: "comment-form" }) 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 %>
<% end %>
<% if @comment.persisted? %>
<% end %>
Templates let you quickly answer FAQs or store snippets for re-use.