Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8129 list attachments on info request admin page #8130

Draft
wants to merge 7 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 public_token?
defined?(public_token) && public_token.present?
end

def fetch_foi_attachments(info_request)
HelenWDTK marked this conversation as resolved.
Show resolved Hide resolved
info_request.incoming_messages

Check warning on line 340 in app/helpers/info_request_helper.rb

View workflow job for this annotation

GitHub Actions / build

[rubocop] reported by reviewdog 🐶 Use 2 (not 0) spaces for indentation. (https://rubystyle.guide#spaces-indentation) Raw Output: app/helpers/info_request_helper.rb:340:3: C: Layout/IndentationWidth: Use 2 (not 0) spaces for indentation. (https://rubystyle.guide#spaces-indentation)
.includes(:foi_attachments)

Check warning on line 341 in app/helpers/info_request_helper.rb

View workflow job for this annotation

GitHub Actions / build

[rubocop] reported by reviewdog 🐶 Place the . on the previous line, together with the method call receiver. (https://rubystyle.guide#consistent-multi-line-chains) Raw Output: app/helpers/info_request_helper.rb:341:15: C: Layout/DotPosition: Place the . on the previous line, together with the method call receiver. (https://rubystyle.guide#consistent-multi-line-chains)
.flat_map(&:foi_attachments)

Check warning on line 342 in app/helpers/info_request_helper.rb

View workflow job for this annotation

GitHub Actions / build

[rubocop] reported by reviewdog 🐶 Place the . on the previous line, together with the method call receiver. (https://rubystyle.guide#consistent-multi-line-chains) Raw Output: app/helpers/info_request_helper.rb:342:15: C: Layout/DotPosition: Place the . on the previous line, together with the method call receiver. (https://rubystyle.guide#consistent-multi-line-chains)
.reject(&:main_body_part?)

Check warning on line 343 in app/helpers/info_request_helper.rb

View workflow job for this annotation

GitHub Actions / build

[rubocop] reported by reviewdog 🐶 Place the . on the previous line, together with the method call receiver. (https://rubystyle.guide#consistent-multi-line-chains) Raw Output: app/helpers/info_request_helper.rb:343:15: C: Layout/DotPosition: Place the . on the previous line, together with the method call receiver. (https://rubystyle.guide#consistent-multi-line-chains)
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>
HelenWDTK marked this conversation as resolved.
Show resolved Hide resolved
<%= render partial: 'admin_request/some_attachments' %>
HelenWDTK marked this conversation as resolved.
Show resolved Hide resolved

<hr>

<h2>Annotations</h2>

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