Add persistent/cache toggle to collections#show page.
[arvados.git] / apps / workbench / app / views / collections / _show_files.html.erb
1 <% content_for :css do %>
2 .file-list-inline-image {
3   width: 50%;
4   height: auto;
5 }
6 <% end %>
7
8 <% content_for :tab_line_buttons do %>
9 <div class="row">
10   <div class="col-md-6"></div>
11   <div class="col-md-6">
12     <div class="pull-right">
13       Collection storage status:
14       <%= render partial: 'toggle_persist', locals: { uuid: @object.uuid, current_state: (@is_persistent ? 'persistent' : 'cache') } %>
15     </div>
16   </div>
17 </div>
18 <% end %>
19
20 <table class="table table-condensed table-fixedlayout">
21   <colgroup>
22     <col width="4%" />
23     <col width="35%" />
24     <col width="40%" />
25     <col width="15%" />
26     <col width="10%" />
27   </colgroup>
28   <thead>
29     <tr>
30       <th></th>
31       <th>path</th>
32       <th>file</th>
33       <th style="text-align:right">size</th>
34       <th>d/l</th>
35     </tr>
36   </thead><tbody>
37     <% if @object then @object.files.sort_by{|f|[f[0],f[1]]}.each do |file| %>
38       <% file_path = CollectionsHelper::file_path file %>
39       <tr>
40         <td>
41           <%= check_box_tag 'uuids[]', @object.uuid+'/'+file_path, false, {
42                 :class => 'persistent-selection',
43                 :friendly_type => "File",
44                 :friendly_name => "#{@object.uuid}/#{file_path}",
45                 :href => "#{url_for controller: 'collections', action: 'show', id: @object.uuid }/#{file_path}",
46                 :title => "Click to add this item to your selection list"
47               } %>
48         </td>
49         <td>
50           <%= file[0] %>
51         </td>
52
53       <td>
54         <%= link_to (if CollectionsHelper::is_image file[1]
55                        image_tag "#{url_for @object}/#{file_path}", class: "file-list-inline-image"
56                      else
57                        file[1]
58                      end),
59             {controller: 'collections', action: 'show_file', uuid: @object.uuid, file: file_path, size: file[2], disposition: 'inline'},
60             {title: file_path} %>
61       </td>
62
63         <td style="text-align:right">
64           <%= raw(human_readable_bytes_html(file[2])) %>
65         </td>
66
67         <td>
68           <div style="display:inline-block">
69             <%= link_to raw('<i class="glyphicon glyphicon-download-alt"></i>'), {controller: 'collections', action: 'show_file', uuid: @object.uuid, file: file_path, size: file[2], disposition: 'attachment'}, {class: 'btn btn-info btn-sm', title: 'Download'} %>
70           </div>
71         </td>
72       </tr>
73     <% end; end %>
74   </tbody>
75 </table>