caches comments

This commit is contained in:
rgarcia
2015-09-05 21:54:14 +02:00
parent 93378eea98
commit 5200d76be6
3 changed files with 141 additions and 105 deletions

View File

@@ -0,0 +1,30 @@
<% cache [locale_and_user_status, @all_visible_comments.map(&:cache_key), @debate.comments_count, @comment_flags.to_a] do %>
<section class="row-full comments">
<div class="row">
<div id="comments" class="small-12 column">
<h2>
<%= t("debates.show.comments_title") %>
<span>(<%= @debate.comments_count %>)</span>
</h2>
<% if user_signed_in? %>
<%= render 'comments/form', {commentable: @debate, parent_id: nil, toggeable: false} %>
<% else %>
<br>
<div class="alert-box radius info">
<%= t("debates.show.login_to_comment",
signin: link_to(t("votes.signin"), new_user_session_path),
signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %>
</div>
<% end %>
<% @root_comments.each do |comment| %>
<%= render 'comments/comment', comment: comment %>
<% end %>
<%= paginate @root_comments %>
</div>
</div>
</section>
<% end %>