Use a <ul> tag for a list of comments
We were using a <ul> tag for a single comment, where the first element of the list was the comment itself and the second element was the list of replies. IMHO it makes more sense to have a list of all comments, where every element is a comment and inside it there's a list of replies. We're also rendering the list even if it has no children so it's easier to add comments through JavaScript. Then we use the :empty CSS selector to hide the list if it's empty. However, since ERB adds whitespace if we structure our code the usual way and current browsers don't recognize elements with whitespace as empty, we have to use the `tag` helper so no whitespace is added.
This commit is contained in:
@@ -35,9 +35,7 @@
|
||||
<%= render "shared/login_to_comment" %>
|
||||
<% end %>
|
||||
|
||||
<% comment_tree.root_comments.each do |comment| %>
|
||||
<%= render "comments/comment", { comment: comment, valuation: valuation } %>
|
||||
<% end %>
|
||||
<%= render "comments/comment_list", comments: comment_tree.root_comments, valuation: valuation %>
|
||||
<%= paginate comment_tree.root_comments %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user