From a0978c70400be0b643c09247a0f95fa28d6d1c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baz=C3=A1n?= Date: Mon, 14 Sep 2015 17:14:46 +0200 Subject: [PATCH] adds cache to proposal comments --- app/views/proposals/_comments.html.erb | 48 ++++++++++++++------------ 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/app/views/proposals/_comments.html.erb b/app/views/proposals/_comments.html.erb index 6270c58b6..f9047d83b 100644 --- a/app/views/proposals/_comments.html.erb +++ b/app/views/proposals/_comments.html.erb @@ -1,27 +1,29 @@ -
-
-
-

- <%= t("proposals.show.comments_title") %> - (<%= @proposal.comments_count %>) -

+<% cache [locale_and_user_status, commentable_cache_key(@proposal), @all_visible_comments, @all_visible_comments.map(&:author), @proposal.comments_count, @comment_flags] do %> +
+
+
+

+ <%= t("proposals.show.comments_title") %> + (<%= @proposal.comments_count %>) +

- <% if user_signed_in? %> - <%= render 'comments/form', {commentable: @proposal, parent_id: nil, toggeable: false} %> - <% else %> -
+ <% if user_signed_in? %> + <%= render 'comments/form', {commentable: @proposal, parent_id: nil, toggeable: false} %> + <% else %> +
-
- <%= t("proposals.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 %> -
- <% end %> +
+ <%= t("proposals.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 %> +
+ <% end %> - <% @root_comments.each do |comment| %> - <%= render 'comments/comment', comment: comment %> - <% end %> - <%= paginate @root_comments %> + <% @root_comments.each do |comment| %> + <%= render 'comments/comment', comment: comment %> + <% end %> + <%= paginate @root_comments %> +
-
-
\ No newline at end of file + +<% end %> \ No newline at end of file