Skip to content

Commit

Permalink
Merge 134b3a3 into 08aa218
Browse files Browse the repository at this point in the history
  • Loading branch information
HelenWDTK committed Feb 12, 2024
2 parents 08aa218 + 134b3a3 commit d7679f5
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/helpers/info_request_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -335,4 +335,11 @@ def attachment_params(attachment, options = {})
def public_token?
defined?(public_token) && public_token.present?
end

def fetch_foi_attachments(info_request)
info_request.incoming_messages
.includes(:foi_attachments)
.flat_map(&:foi_attachments)
.reject(&:main_body_part?)
end
end
27 changes: 27 additions & 0 deletions app/views/admin_request/_some_attachments.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<fieldset id="attachments" class="form-horizontal">
<% foi_attachments = fetch_foi_attachments(@info_request) %>
<% if foi_attachments.any? %>
<table class="table">
<thead>
<tr>
<th>Attachment</th>
<th>Content Type</th>
<th>Hexdigest</th>
<th>Display Size</th>
</tr>
</thead>
<tbody>
<% foi_attachments.each do |attachment| %>
<tr>
<td><%= both_links attachment %></td>
<td><span class="monospace"><%= attachment.content_type %></span></td>
<td><span class="monospace"><%= attachment.hexdigest %></span></td>
<td><span class="monospace"><%= attachment.display_size %></span></td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<p>None yet.</p>
<% end %>
</fieldset>
5 changes: 5 additions & 0 deletions app/views/admin_request/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,11 @@

<hr>

<h2> Attachments </h2>
<%= render partial: 'admin_request/some_attachments' %>

<hr>

<h2>Annotations</h2>

<%= render partial: 'admin_request/some_annotations' ,
Expand Down

0 comments on commit d7679f5

Please sign in to comment.