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:
Javi Martín
2020-05-11 17:17:12 +02:00
parent 61a63ddd59
commit ae41becd3a
9 changed files with 11 additions and 8 deletions

View File

@@ -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 %>

View File

@@ -27,7 +27,6 @@
<% elsif !valuation || can?(:comment_valuation, commentable) %>
<%= render "comments/form", { commentable: commentable,
parent_id: nil,
toggeable: false,
valuation: valuation } %>
<% end %>
<% else %>

View File

@@ -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}",