Merge branch '18947-githttpd'
[arvados.git] / apps / workbench / app / views / collections / show_file_links.html.erb
index 9d61a6a2d932807018fa005ffd17659d139100f5..d7483a6ab747e77e5c7b23aaf577eced2c9670d8 100644 (file)
@@ -1,36 +1,86 @@
+<%# Copyright (C) The Arvados Authors. All rights reserved.
+
+SPDX-License-Identifier: AGPL-3.0 %>
+
 <!DOCTYPE html>
-<html>
+<html lang="en">
+<% coll_name = "Collection #{@object.uuid}" %>
+<% link_opts = {controller: 'collections', action: 'show_file',
+                uuid: @object.uuid, reader_token: params[:reader_token]} %>
 <head>
   <meta charset="utf-8">
   <title>
-    <% if content_for? :page_title %>
-    <%= yield :page_title %> / <%= Rails.configuration.site_name %>
-    <% else %>
-    <%= Rails.configuration.site_name %>
-    <% end %>
+    <%= coll_name %> / <%= Rails.configuration.Workbench.SiteName %>
   </title>
   <meta name="description" content="">
   <meta name="author" content="">
   <meta name="robots" content="NOINDEX">
+  <style type="text/css">
+body {
+  margin: 1.5em;
+}
+pre {
+  background-color: #D9EDF7;
+  border-radius: .25em;
+  padding: .75em;
+  overflow: auto;
+}
+.footer {
+  font-size: 82%;
+}
+.footer h2 {
+  font-size: 1.2em;
+}
+  </style>
 </head>
 <body>
-<% content_for :page_title do %>
-  <%= (@object.respond_to?(:properties) ? @object.properties[:page_title] : nil) ||
-        @object.friendly_link_name %>
-<% end %>
 
-<% if @object.andand.files.andand.any? %>
-  <% link_opts = {controller: 'collections', action: 'show_file',
-                  uuid: @object.uuid, reader_token: params[:reader_token]} %>
-  <ul>
-  <% @object.files.map { |spec|
-       CollectionsHelper::file_path(spec)
-     }.each do |path| %>
-    <li><%= link_to(path, link_opts.merge(file: path)) %></li>
+<h1><%= coll_name %></h1>
+
+<p>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:</p>
+
+<pre>$ wget --mirror --no-parent --no-host --cut-dirs=3 <%=
+         url_for(link_opts.merge(action: 'show_file_links', only_path: false,
+                                 trailing_slash: true))
+       %></pre>
+
+<h2>File Listing</h2>
+
+<% file_tree = @object.andand.files_tree %>
+<% if file_tree.andand.any? %>
+  <ul id="collection_files" class="collection_files">
+  <% dirstack = [file_tree.first.first] %>
+  <% file_tree.take(10000).each_with_index do |(dirname, filename, size), index| %>
+    <% file_path = CollectionsHelper::file_path([dirname, filename]) %>
+    <% while dirstack.any? and (dirstack.last != dirname) %>
+      <% dirstack.pop %></ul></li>
+    <% end %>
+    <li>
+    <% if size.nil?  # This is a subdirectory. %>
+      <% dirstack.push(File.join(dirname, filename)) %>
+      <%= filename %>
+      <ul class="collection_files">
+    <% else %>
+      <%= link_to(filename,
+                  link_opts.merge(file: file_path),
+                  {title: "Download #{file_path}"}) %>
+      </li>
+    <% end %>
   <% end %>
-  </ul>
+  <%= raw(dirstack.map { |_| "</ul>" }.join("</li>")) %>
 <% else %>
   <p>No files in this collection.</p>
 <% end %>
+
+<div class="footer">
+<h2>About Arvados</h2>
+
+<p>Arvados is a free and open source software bioinformatics platform.
+To learn more, visit arvados.org.
+Arvados is not responsible for the files listed on this page.</p>
+</div>
+
 </body>
 </html>