Use CSS to hide reply forms
We were using inline styles and passing local variables around, while the rule we were following is very simple: it's only hidden if it's a form to reply to a comment.
This commit is contained in:
@@ -107,7 +107,6 @@
|
||||
<% if !valuation || can?(:comment_valuation, comment.commentable) %>
|
||||
<%= render "comments/form", { commentable: comment.commentable,
|
||||
parent_id: comment.id,
|
||||
toggeable: true,
|
||||
valuation: valuation } %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
<% elsif !valuation || can?(:comment_valuation, commentable) %>
|
||||
<%= render "comments/form", { commentable: commentable,
|
||||
parent_id: nil,
|
||||
toggeable: false,
|
||||
valuation: valuation } %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<% valuation = local_assigns.fetch(:valuation, false) %>
|
||||
<% cache [locale_and_user_status, parent_id, commentable_cache_key(commentable), valuation] do %>
|
||||
<% css_id = parent_or_commentable_dom_id(parent_id, commentable) %>
|
||||
<div id="js-comment-form-<%= css_id %>" <%= raw("style='display:none'") if toggeable %> class="comment-form">
|
||||
<div id="js-comment-form-<%= css_id %>" class="comment-form">
|
||||
<%= form_for Comment.new, remote: true, html: { id: "new_comment_#{css_id}" } do |f| %>
|
||||
<%= f.text_area :body,
|
||||
id: "comment-body-#{css_id}",
|
||||
|
||||
Reference in New Issue
Block a user