Make comments count display optional using a variable on comments comment_tree partial

This commit is contained in:
Bertocq
2017-06-26 18:52:43 +02:00
parent ce7a67418b
commit 6c386ffd95
3 changed files with 12 additions and 7 deletions

View File

@@ -4,10 +4,12 @@
<section class="expanded comments"> <section class="expanded comments">
<div class="row"> <div class="row">
<div id="comments" class="small-12 column"> <div id="comments" class="small-12 column">
<h2> <% if display_comments_count %>
<%= comment_tree_title_text(commentable) %> <h2>
<span class="js-comments-count">(<%= commentable.comments_count %>)</span> <%= comment_tree_title_text(commentable) %>
</h2> <span class="js-comments-count">(<%= commentable.comments_count %>)</span>
</h2>
<% end %>
<%= render 'shared/wide_order_selector', i18n_namespace: "comments" %> <%= render 'shared/wide_order_selector', i18n_namespace: "comments" %>

View File

@@ -40,7 +40,9 @@
</aside> </aside>
</div> </div>
<%= render partial: '/comments/comment_tree', locals: { comment_tree: @comment_tree, comment_flags: @comment_flags } %> <%= render partial: '/comments/comment_tree', locals: { comment_tree: @comment_tree,
comment_flags: @comment_flags,
display_comments_count: true } %>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -42,6 +42,7 @@
</aside> </aside>
</div> </div>
<%= render partial: '/comments/comment_tree', locals: { comment_tree: @comment_tree, comment_flags: @comment_flags } %> <%= render partial: '/comments/comment_tree', locals: { comment_tree: @comment_tree,
comment_flags: @comment_flags,
display_comments_count: true } %>
</section> </section>