adds cache to proposal comments

This commit is contained in:
Juanjo Bazán
2015-09-14 17:14:46 +02:00
parent 93666dcb4a
commit a0978c7040

View File

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