[ARVADOS] created: d0f8dba42b3a4c1ca3ae66bb4ad79ec78a1d26d5

git at public.curoverse.com git at public.curoverse.com
Thu Jan 2 12:42:35 EST 2014


        at  d0f8dba42b3a4c1ca3ae66bb4ad79ec78a1d26d5 (commit)


commit d0f8dba42b3a4c1ca3ae66bb4ad79ec78a1d26d5
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Jan 2 09:41:06 2014 -0800

    Link to show/download files from collections. refs #1748

diff --git a/apps/workbench/app/controllers/collections_controller.rb b/apps/workbench/app/controllers/collections_controller.rb
index 3cea60b..bf311dd 100644
--- a/apps/workbench/app/controllers/collections_controller.rb
+++ b/apps/workbench/app/controllers/collections_controller.rb
@@ -48,6 +48,8 @@ class CollectionsController < ApplicationController
     end
     self.response.headers['Content-Type'] =
       Rack::Mime::MIME_TYPES[ext] || 'application/octet-stream'
+    self.response.headers['Content-Length'] = params[:size] if params[:size]
+    self.response.headers['Content-Disposition'] = params[:disposition] if params[:disposition]
     self.response_body = FileStreamer.new opts
   end
 
diff --git a/apps/workbench/app/views/collections/show.html.erb b/apps/workbench/app/views/collections/show.html.erb
index 3dc9762..cc8eec3 100644
--- a/apps/workbench/app/views/collections/show.html.erb
+++ b/apps/workbench/app/views/collections/show.html.erb
@@ -27,16 +27,29 @@
 
 <div class="tab-content">
   <div id="files" class="tab-pane fade in active">
-    <table class="table table-bordered">
+    <table class="table table-bordered" style="table-layout: fixed">
       <thead>
-        <tr><th style="text-align:right">size (bytes)</th><th>filename</th></tr>
+        <tr>
+          <th style="width: 10em; text-align:right">size</th>
+          <th>
+            <div style="width:3.5em; display:inline-block"></div>
+            path
+          </th>
+        </tr>
       </thead><tbody>
-        <% if @object then @object.files.each do |file| %>
+        <% if @object then @object.files.sort_by{|f|f[1]}.each do |file| %>
+        <% file_path = "#{file[0]}/#{file[1]}" %>
         <tr>
           <td style="text-align:right">
             <%= raw(human_readable_bytes_html(file[2])) %>
           </td><td>
-            <%= file[0] %>/<%= file[1] %>
+            <div style="width:3.5em; display:inline-block">
+            <%= link_to raw('<i class="icon-download"></i>'), {controller: 'collections', action: 'show_file', uuid: @object.uuid, file: file_path, size: file[2], disposition: 'attachment'}, {class: 'label label-info', title: 'Download'} %>
+            <% if file_path.match /\.(txt|pdf|png|jpe?g|gif|tiff?)$/i %>
+            <%= link_to raw('<i class="icon-play"></i>'), {controller: 'collections', action: 'show_file', uuid: @object.uuid, file: file_path, size: file[2], disposition: 'inline'}, {class: 'label label-info', title: 'View in browser'} %>
+            <% end %>
+            </div>
+            <%= file_path %>
           </td>
         </tr>
         <% end; end %>

commit 36c9bf0c6243b987270b80c3764ad4ade49a0cbc
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Dec 31 10:48:28 2013 -0800

    Fix error message: print the exit status, not the string "$?".

diff --git a/apps/workbench/app/controllers/collections_controller.rb b/apps/workbench/app/controllers/collections_controller.rb
index a5fed9d..3cea60b 100644
--- a/apps/workbench/app/controllers/collections_controller.rb
+++ b/apps/workbench/app/controllers/collections_controller.rb
@@ -121,7 +121,7 @@ class CollectionsController < ApplicationController
           yield buf
         end
       end
-      Rails.logger.warn("#{@opts[:uuid]}/#{@opts[:file]}: $?") if $? != 0
+      Rails.logger.warn("#{@opts[:uuid]}/#{@opts[:file]}: #{$?}") if $? != 0
     end
   end
 end

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list