Implements comment sorting in proposals and debates

This commit is contained in:
kikito
2015-10-28 18:40:32 +01:00
parent 26a9ca58cd
commit 50fdd005a4
4 changed files with 35 additions and 3 deletions

View File

@@ -16,7 +16,7 @@ module CommentableActions
def show
set_resource_votes(resource)
@commentable = resource
@root_comments = resource.comments.roots.recent.page(params[:page]).per(10).for_render
@root_comments = resource.comments.roots.send("sort_by_#{@current_order}").page(params[:page]).per(10).for_render
@comments = @root_comments.inject([]){|all, root| all + Comment.descendants_of(root).for_render}
@all_visible_comments = @root_comments + @comments
@@ -91,4 +91,4 @@ module CommentableActions
def index_customization
nil
end
end
end