diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index bf8bfb50d..98a0154cc 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -1,4 +1,5 @@ -<% cache [locale_and_user_status(comment), comment, commentable_cache_key(comment.commentable), comment.author, (@comment_flags[comment.id] if @comment_flags)] do %> +<% comment_flags ||= @comment_flags %> +<% cache [locale_and_user_status(comment), comment, commentable_cache_key(comment.commentable), comment.author, (comment_flags[comment.id] if comment_flags)] do %>
diff --git a/app/views/comments/_comment_tree.html.erb b/app/views/comments/_comment_tree.html.erb new file mode 100644 index 000000000..0581809fb --- /dev/null +++ b/app/views/comments/_comment_tree.html.erb @@ -0,0 +1,34 @@ +<% commentable = comment_tree.commentable %> +<% current_order = comment_tree.order %> + +<% cache [locale_and_user_status, current_order, commentable_cache_key(commentable), comment_tree.comments, comment_tree.comment_authors, commentable.comments_count, comment_flags] do %> +
+
+
+

+ <%= t("debates.show.comments_title") %> + (<%= commentable.comments_count %>) +

+ + <%= render 'shared/wide_order_selector', i18n_namespace: "comments" %> + + <% if user_signed_in? %> + <%= render 'comments/form', {commentable: commentable, parent_id: nil, toggeable: false} %> + <% else %> +
+ +
+ <%= 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 %> +
+ <% end %> + + <% comment_tree.root_comments.each do |comment| %> + <%= render 'comments/comment', {comment: comment, comment_flags: comment_flags} %> + <% end %> + <%= paginate comment_tree.root_comments %> +
+
+
+<% end %>