Merges annotations

This commit is contained in:
rgarcia
2017-06-07 14:58:34 +02:00
parent f66102abdc
commit 792b15b224
9 changed files with 235 additions and 41 deletions

View File

@@ -8,7 +8,7 @@ class Legislation::AnnotationsController < ApplicationController
load_and_authorize_resource :draft_version, through: :process
load_and_authorize_resource
has_orders %w{most_voted newest oldest}, only: :show
has_orders %w{most_voted newest}, only: :show
def index
@annotations = @draft_version.annotations
@@ -16,7 +16,15 @@ class Legislation::AnnotationsController < ApplicationController
def show
@commentable = @annotation
@comment_tree = CommentTree.new(@commentable, params[:page], @current_order)
if params[:sub_annotation_ids].present?
@sub_annotations = Legislation::Annotation.where(id: params[:sub_annotation_ids].split(','))
annotations = [@commentable, @sub_annotations]
else
annotations = [@commentable]
end
@comment_tree = MergedCommentTree.new(annotations, params[:page], @current_order)
set_comment_flags(@comment_tree.comments)
end