Merge branch 'master' into 2681-new-inactive-user-notification
[arvados.git] / apps / workbench / app / views / collections / show_file_links.html.erb
1 <!DOCTYPE html>
2 <html>
3 <% coll_name = (@object.name =~ /\S/) ? @object.name : "Collection #{@object.uuid}" %>
4 <% link_opts = {controller: 'collections', action: 'show_file',
5                 uuid: @object.uuid, reader_token: params[:reader_token]} %>
6 <head>
7   <meta charset="utf-8">
8   <title>
9     <%= coll_name %> / <%= Rails.configuration.site_name %>
10   </title>
11   <meta name="description" content="">
12   <meta name="author" content="">
13   <meta name="robots" content="NOINDEX">
14   <style type="text/css">
15 body {
16   margin: 1.5em;
17 }
18 pre {
19   background-color: #D9EDF7;
20   border-radius: .25em;
21   padding: .75em;
22   overflow: auto;
23 }
24 .footer {
25   font-size: 82%;
26 }
27 .footer h2 {
28   font-size: 1.2em;
29 }
30   </style>
31 </head>
32 <body>
33
34 <h1><%= coll_name %></h1>
35
36 <p>This collection of data files is being shared with you through
37 Arvados.  You can download individual files listed below.  To download
38 the entire collection with wget, try:</p>
39
40 <pre>$ wget --mirror --no-parent --no-host --cut-dirs=3 <%=
41          url_for(link_opts.merge(action: 'show_file_links', only_path: false))
42        %></pre>
43
44 <h2>File Listing</h2>
45
46 <% if @object.andand.files_tree.andand.any? %>
47   <ul id="collection_files" class="collection_files">
48   <% dirstack = [@object.files_tree.first.first] %>
49   <% @object.files_tree.each_with_index do |(dirname, filename, size), index| %>
50     <% file_path = CollectionsHelper::file_path([dirname, filename]) %>
51     <% while dirstack.any? and (dirstack.last != dirname) %>
52       <% dirstack.pop %></ul></li>
53     <% end %>
54     <li>
55     <% if size.nil?  # This is a subdirectory. %>
56       <% dirstack.push(File.join(dirname, filename)) %>
57       <%= filename %>
58       <ul class="collection_files">
59     <% else %>
60       <%= link_to(filename,
61                   {controller: 'collections', action: 'show_file',
62                    uuid: @object.uuid, file: file_path,
63                    reader_token: params[:reader_token]},
64                   {title: "Download #{file_path}"}) %>
65       </li>
66     <% end %>
67   <% end %>
68   <%= raw(dirstack.map { |_| "</ul>" }.join("</li>")) %>
69 <% else %>
70   <p>No files in this collection.</p>
71 <% end %>
72
73 <div class="footer">
74 <h2>About Arvados</h2>
75
76 <p>Arvados is a free and open source software bioinformatics platform.
77 To learn more, visit arvados.org.
78 Arvados is not responsible for the files listed on this page.</p>
79 </div>
80
81 </body>
82 </html>