From 6f2e6c74a757e7bb56f8e3307340213477ba8a74 Mon Sep 17 00:00:00 2001 From: Michael Cain Date: Tue, 21 Nov 2023 14:43:52 -0600 Subject: [PATCH] restore multi-downloads --- .../catalog/_downloads_collapse.html.erb | 32 +++++++++++++++++++ spec/features/show_page_spec.rb | 24 +------------- 2 files changed, 33 insertions(+), 23 deletions(-) create mode 100644 app/views/catalog/_downloads_collapse.html.erb diff --git a/app/views/catalog/_downloads_collapse.html.erb b/app/views/catalog/_downloads_collapse.html.erb new file mode 100644 index 00000000..d8a58301 --- /dev/null +++ b/app/views/catalog/_downloads_collapse.html.erb @@ -0,0 +1,32 @@ +<%# Renders the options of the downloads dropdown button %> +<% document ||= @document %> + +<% if document.multi_direct_downloads.present? %> + <% document.multi_direct_downloads.each do |download| %> + <%= download_link_file(download[0], document.id, download[1]) %> + <% end %> +<% end %> +<% if document.direct_download.present? %> + <% if document.direct_download[:download].is_a? Array %> + <% document.direct_download[:download].each do |download| %> + <%= download_link_file(download['label'], document.id, download['url']) %> + <% end %> + <% end %> + <% if document.direct_download[:download].is_a? String %> + <%= download_link_file(download_text(document.file_format), document.id, document.direct_download[:download]) %> + <% end %> +<% end %> + +<% if document.hgl_download.present? %> + <%= download_link_hgl(download_text(document.download_types.first[0]), document) %> +<% end %> + +<% if document.iiif_download.present? %> + <%= download_link_iiif %> +<% end %> + +<% if document.download_types.present? %> + <% document.download_types.each do |type| %> + <%= download_link_generated(type.first, document) %> + <% end %> +<% end %> diff --git a/spec/features/show_page_spec.rb b/spec/features/show_page_spec.rb index 0a69a877..3299946a 100644 --- a/spec/features/show_page_spec.rb +++ b/spec/features/show_page_spec.rb @@ -51,34 +51,12 @@ click_on 'Download' expect(page).to have_content('LAZ (Point-cloud)') - expect(page).to have_link( - 'Export', href: 'https://archive.nyu.edu/retrieve/80003/nyu_2451_38645_pc_F_150326_120403.zip' - ) - expect(page).to have_content('LAS (Full-waveform)') - expect(page).to have_link( - 'Export', href: 'https://archive.nyu.edu/retrieve/80002/nyu_2451_38645_fwf_las_F_150326_120403.zip' - ) - expect(page).to have_content('Pulsewaves (Full-waveform)') - expect(page).to have_link( - 'Export', href: 'https://archive.nyu.edu/retrieve/80005/nyu_2451_38645_fwf_plswvs_F_150326_120403.zip' - ) - expect(page).to have_content('GeoTIFF (Geo-referenced RGB)') - expect(page).to have_link( - 'Export', href: 'https://archive.nyu.edu/retrieve/80240/nyu_2451_38645_rgb_F_150326_120403.zip' - ) - expect(page).to have_content('GeoTIFF (Geo-referenced CIR)') - expect(page).to have_link( - 'Export', href: 'https://archive.nyu.edu/retrieve/80001/nyu_2451_38645_cir_F_150326_120403.zip' - ) - expect(page).to have_content('JPG (Oblique photos)') - expect(page).to have_link( - 'Export', href: 'https://archive.nyu.edu/retrieve/80004/nyu_2451_38645_oblique_F_150326_120403.zip' - ) + end end # rubocop:enable RSpec/ExampleLength, RSpec/MultipleExpectations