diff --git a/app/controllers/legislation/annotations_controller.rb b/app/controllers/legislation/annotations_controller.rb index 93de149fa..dc3ff4834 100644 --- a/app/controllers/legislation/annotations_controller.rb +++ b/app/controllers/legislation/annotations_controller.rb @@ -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 diff --git a/app/views/legislation/annotations/_annotation_link.html.erb b/app/views/legislation/annotations/_annotation_link.html.erb new file mode 100644 index 000000000..74f841abd --- /dev/null +++ b/app/views/legislation/annotations/_annotation_link.html.erb @@ -0,0 +1,3 @@ +<%= link_to legislation_process_draft_version_annotation_path(annotation.draft_version.process, annotation.draft_version, annotation, sub_annotation_ids: "") do %> + +<% end %> \ No newline at end of file diff --git a/app/views/legislation/annotations/_comment_header.html.erb b/app/views/legislation/annotations/_comment_header.html.erb new file mode 100644 index 000000000..f8602aa7e --- /dev/null +++ b/app/views/legislation/annotations/_comment_header.html.erb @@ -0,0 +1,10 @@ + + +
<%= truncate comment.body, length: 250 %>
+<%= truncate comment.body, length: 250 %>
-