diff --git a/app/models/legislation/annotation.rb b/app/models/legislation/annotation.rb index 2bdfb3fca..b038b5e51 100644 --- a/app/models/legislation/annotation.rb +++ b/app/models/legislation/annotation.rb @@ -1,4 +1,5 @@ class Legislation::Annotation < ActiveRecord::Base + COMMENTS_PAGE_SIZE = 5 acts_as_paranoid column: :hidden_at include ActsAsParanoidAliases diff --git a/app/views/legislation/annotations/_comments_box.html.erb b/app/views/legislation/annotations/_comments_box.html.erb index 24e87b141..79f702fa0 100644 --- a/app/views/legislation/annotations/_comments_box.html.erb +++ b/app/views/legislation/annotations/_comments_box.html.erb @@ -6,18 +6,20 @@ <% end %>
- <% annotation.comments.roots.each do |comment| %> + <% annotation.comments.roots.limit(5).each do |comment| %>
-

<%= comment.body %>

+

<%= truncate comment.body, length: 250 %>

-
- <%= link_to legislation_process_draft_version_annotation_path(annotation.draft_version.process, annotation.draft_version, annotation) do %> - <%= t('legislation.annotations.comments.see_complete') %> - <% end %> -
+ <% if comment.body.length > 250 %> +
+ <%= link_to legislation_process_draft_version_annotation_path(annotation.draft_version.process, annotation.draft_version, annotation) do %> + <%= t('legislation.annotations.comments.see_complete') %> + <% end %> +
+ <% end %>
<%= link_to legislation_process_draft_version_annotation_path(annotation.draft_version.process, annotation.draft_version, annotation) do %> <%= t('legislation.annotations.comments.replies_count', count: comment.children.size) %> @@ -35,8 +37,10 @@