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

Fix bugs in reviewer downloads and version display #1869

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion app/views/stash_datacite/resources/_show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</div>

<% if @id.may_download?(user: current_user) %>
<%= render partial: 'stash_engine/landing/files', locals: {dataset_identifier: @id} %>
<%= render partial: 'stash_engine/landing/files', locals: {dataset_identifier: @id, share: nil} %>
<% else %>
<%= render partial: 'stash_engine/landing/files_embargoed', locals: {resource: @resource} %>
<% end %>
Expand Down
4 changes: 3 additions & 1 deletion app/views/stash_engine/downloads/_download.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
<div class="screen-reader-only" id="accessible-dl-msg" aria-live="assertive"></div>
</div>
<% content_for :doc_end do %>
<% params = {resource_id: @resource.id} %>
<% params[:share] = share if share.present? %>
<script type="text/javascript" async>
const dlbutton = document.getElementById('download_zip_button');
if ("serviceWorker" in navigator) {
const zip_url = '<%= stash_url_helpers.zip_assembly_info_path(resource_id: @resource.id)%>';
const zip_url = '<%= stash_url_helpers.zip_assembly_info_path(params)%>';
const scope = '<%= worker_scope %>';
<%= render partial: 'stash_engine/downloads/download_zip', formats: :js %>
} else {
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 @@ -4,7 +4,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, resource: @resource} %>
<%= render partial: 'stash_engine/landing/files', locals: {dataset_identifier: @resource.identifier, share: {resource: @resource, code: params[:id]}} %>

<%
sfw = @resource.software_files.present_files
Expand Down
12 changes: 7 additions & 5 deletions app/views/stash_engine/landing/_files.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<%
if resource.present?
resources = [resource]
dl_resource = resource
if share.present?
resources = [share[:resource]]
dl_resource = share[: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
Expand All @@ -24,9 +24,11 @@
</summary>
<ul class="c-file-group__list">
<% res.current_file_uploads.each do |fu| %>
<% params = {file_id: fu.id} %>
<% params[:share] = share[:code] if share.present? %>
<li>
<span>
<%= link_to "<i class=\"fas fa-download\" aria-hidden=\"true\"></i>#{fu.upload_file_name.ellipsisize(200)}".html_safe, Rails.application.routes.url_helpers.download_stream_path(fu.id),
<%= link_to "<i class=\"fas fa-download\" aria-hidden=\"true\"></i>#{fu.upload_file_name.ellipsisize(200)}".html_safe, Rails.application.routes.url_helpers.download_stream_path(params),
title: fu.upload_file_name, target: '_blank', class: 'js-individual-dl' %>
<div id="file_preview_check<%= fu.id %>" data-load="<%= preview_check_path(file_id: fu.id, format: :js) %>">
<i class="fa fa-spin fa-spinner" aria-hidden="true" style="color: #888"></i>
Expand All @@ -40,7 +42,7 @@
<% end %>
<div id="file_preview_box"></div>
<!-- full download second -->
<%= render partial: 'stash_engine/downloads/download', locals: { dataset_identifier: dataset_identifier, resource: dl_resource } %>
<%= render partial: 'stash_engine/downloads/download', locals: { dataset_identifier: dataset_identifier, resource: dl_resource, share: share.present? ? share[:code] : nil } %>
<% else %>
<p>No data files are available for display.</p>
<% end %>
Expand Down