comments.js: fix forms flickering on page load.

Mark the edit form, new comment form, and unvote links as hidden in
html, instead of showing them by default then hiding them later in
Javascript. This eliminates flickering on page load.
This commit is contained in:
evazion
2018-08-09 00:24:08 -05:00
parent c615b53a7e
commit 8e8a39af43
5 changed files with 5 additions and 15 deletions

View File

@@ -1,6 +1,6 @@
<%= error_messages_for :comment %>
<%= simple_form_for(comment, :html => {:class => "edit_comment"}) do |f| %>
<%= simple_form_for(comment, :html => {:style => ("display: none;" if local_assigns[:hidden]), :class => "edit_comment"}) do |f| %>
<%= f.hidden_field :post_id %>
<%= dtext_field "comment", "body", :classes => "autocomplete-mentions", :value => comment.body, :input_id => "comment_body_for_#{comment.id}", :preview_id => "dtext-preview-for-#{comment.id}" %>
<%= f.button :submit, "Submit" %>