Don't render selection check boxes when using show_file partials from chooser
[arvados.git] / apps / workbench / app / views / collections / _show_files.html.erb
1 <% content_for :tab_line_buttons do %>
2 <span style="padding-left: 1em">Collection storage status:</span>
3 <%= render partial: 'toggle_persist', locals: { uuid: @object.uuid, current_state: (@is_persistent ? 'persistent' : 'cache') } %>
4 <% end %>
5
6 <% file_tree = @object.andand.files_tree %>
7 <% if file_tree.nil? or file_tree.empty? %>
8   <p>This collection is empty.</p>
9 <% else %>
10   <ul id="collection_files" class="collection_files">
11   <% dirstack = [file_tree.first.first] %>
12   <% file_tree.each_with_index do |(dirname, filename, size), index| %>
13     <% file_path = CollectionsHelper::file_path([dirname, filename]) %>
14     <% while dirstack.any? and (dirstack.last != dirname) %>
15       <% dirstack.pop %></ul></li>
16     <% end %>
17     <li>
18     <% if size.nil?  # This is a subdirectory. %>
19       <% dirstack.push(File.join(dirname, filename)) %>
20       <div class="collection_files_row">
21        <div class="collection_files_name"><i class="fa fa-fw fa-folder-open"></i> <%= filename %></div>
22       </div>
23       <ul class="collection_files">
24     <% else %>
25       <% link_params = {controller: 'collections', action: 'show_file',
26                         uuid: @object.uuid, file: file_path, size: size} %>
27        <div class="collection_files_row">
28         <div class="collection_files_buttons pull-right">
29           <%= raw(human_readable_bytes_html(size)) %>
30           <% if !defined? no_checkboxes or !no_checkboxes %>
31           <%= check_box_tag 'uuids[]', "#{@object.uuid}/#{file_path}", false, {
32                 :class => 'persistent-selection',
33                 :friendly_type => "File",
34                 :friendly_name => "#{@object.uuid}/#{file_path}",
35                 :href => url_for(controller: 'collections', action: 'show_file',
36                                  uuid: @object.uuid, file: file_path),
37                 :title => "Include #{file_path} in your selections",
38               } %>
39           <% end %>
40           <%= link_to(raw('<i class="fa fa-search"></i>'),
41                       link_params.merge(disposition: 'inline'),
42                       {title: "View #{file_path}", class: "btn btn-info btn-sm"}) %>
43           <%= link_to(raw('<i class="fa fa-download"></i>'),
44                       link_params.merge(disposition: 'attachment'),
45                       {title: "Download #{file_path}", class: "btn btn-info btn-sm"}) %>
46         </div>
47       <% if CollectionsHelper::is_image(filename) %>
48         <div class="collection_files_name"><i class="fa fa-fw fa-bar-chart-o"></i> <%= filename %></div>
49        </div>
50         <div class="collection_files_inline">
51           <%= link_to(image_tag("#{url_for @object}/#{file_path}"),
52                       link_params.merge(disposition: 'inline'),
53                       {title: file_path}) %>
54         </div>
55       <% else %>
56         <div class="collection_files_name"><i class="fa fa-fw fa-file"></i> <%= filename %></div>
57        </div>
58       <% end %>
59       </li>
60     <% end  # if file or directory %>
61   <% end  # file_tree.each %>
62   <%= raw(dirstack.map { |_| "</ul>" }.join("</li>")) %>
63 <% end  # if file_tree %>
64
65 <% content_for :footer_html do %>
66 <div id="collection-sharing-modal-window" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>
67 <% end %>