Skip to content

Commit

Permalink
include README and all file list in reviewer view
Browse files Browse the repository at this point in the history
  • Loading branch information
ahamelers committed Sep 14, 2024
1 parent 8486953 commit 70d51b3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
9 changes: 1 addition & 8 deletions app/views/stash_datacite/resources/_show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@
</div>

<% if @id.may_download?(user: current_user) %>
<%
resources = @id.resources.files_published # the public ones
if @user_type == 'privileged' # add any non-public, submitted to merritt resources with changes
res_id = resources.last&.id || 0
resources = resources.to_a + @id.resources_with_file_changes.submitted.where('stash_engine_resources.id > ?', res_id).to_a
end
%>
<%= render partial: 'stash_engine/landing/files', locals: {dataset_identifier: @id, resources: resources} %>
<%= render partial: 'stash_engine/landing/files', locals: {dataset_identifier: @id} %>
<% else %>
<%= render partial: 'stash_engine/landing/files_embargoed', locals: {resource: @resource} %>
<% end %>
Expand Down
1 change: 0 additions & 1 deletion app/views/stash_engine/downloads/_download.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<% content_for(:head) do %>
<script type="text/javascript" src="https://16077a4ae659.us-west-2.captcha-sdk.awswaf.com/16077a4ae659/jsapi.js" defer></script>
<% end %>
<% resource = dataset_identifier.latest_downloadable_resource(user: current_user) %>
<% if resource.total_file_size < APP_CONFIG.maximums.zip_size %>
<div class="o-download">
<%= form_with url: "/stash/downloadZip/#{"doi_#{dataset_identifier.identifier}__v#{minimal_date(resource.publication_date.present? && resource.publication_date < Time.now.utc ? resource.publication_date : resource.updated_at)}".gsub(/\.|:|\//, '_')}.zip", method: :post, name: 'download', id: 'zip_download', remote: true do |form| %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/stash_engine/downloads/share.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<h1 class="c-datasets-heading__heading o-heading__level1"><%= @resource.title %></h1>
<p>This dataset is currently private for peer review. You have been invited to download this dataset.</p>

<%= render partial: 'stash_engine/landing/files', locals: {dataset_identifier: @resource.identifier, resources: [@resource]} %>
<%= render partial: 'stash_engine/landing/files', locals: {dataset_identifier: @resource.identifier, resource: @resource} %>
<%
sfw = @resource.software_files.present_files
Expand Down
16 changes: 14 additions & 2 deletions app/views/stash_engine/landing/_files.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
<%# takes local variable of dataset_identifier and resources %>
<%
if resource.present?
resources = [resource]
dl_resource = resource
else
resources = dataset_identifier.resources.files_published # the public ones
if @user_type == 'privileged' # add any non-public, submitted to merritt resources with changes
res_id = resources.last&.id || 0
resources = resources.to_a + dataset_identifier.resources_with_file_changes.submitted.where('stash_engine_resources.id > ?', res_id).to_a
end
dl_resource = dataset_identifier.latest_downloadable_resource(user: current_user)
end
%>
<div class="data_files_section">
<h2>Data files</h2>
<div>
Expand Down Expand Up @@ -28,7 +40,7 @@
<% end %>
<div id="file_preview_box"></div>
<!-- full download second -->
<%= render partial: 'stash_engine/downloads/download', locals: { dataset_identifier: dataset_identifier } %>
<%= render partial: 'stash_engine/downloads/download', locals: { dataset_identifier: dataset_identifier, resource: dl_resource } %>
<% else %>
<p>No data files are available for display.</p>
<% end %>
Expand Down

0 comments on commit 70d51b3

Please sign in to comment.