% coll_name = (@object.name =~ /\S/) ? @object.name : "Collection #{@object.uuid}" %>
<% link_opts = {controller: 'collections', action: 'show_file',
uuid: @object.uuid, reader_token: params[:reader_token]} %>
<%= coll_name %> / <%= Rails.configuration.site_name %>
<%= coll_name %>
This collection of data files is being shared with you through
Arvados. You can download individual files listed below. To download
the entire collection with wget, try:
$ wget --mirror --no-parent --no-host --cut-dirs=3 <%=
url_for(link_opts.merge(action: 'show_file_links', only_path: false))
%>
File Listing
<% if @object.andand.files_tree.andand.any? %>
<% dirstack = [@object.files_tree.first.first] %>
<% @object.files_tree.each_with_index do |(dirname, filename, size), index| %>
<% file_path = CollectionsHelper::file_path([dirname, filename]) %>
<% while dirstack.any? and (dirstack.last != dirname) %>
<% dirstack.pop %>
<% end %>
<% if size.nil? # This is a subdirectory. %>
<% dirstack.push(File.join(dirname, filename)) %>
<%= filename %>
<% else %>
<%= link_to(filename,
{controller: 'collections', action: 'show_file',
uuid: @object.uuid, file: file_path,
reader_token: params[:reader_token]},
{title: "Download #{file_path}"}) %>
<% end %>
<% end %>
<%= raw(dirstack.map { |_| "" }.join("")) %>
<% else %>
No files in this collection.
<% end %>