Merge branch '8784-dir-listings'
[arvados.git] / apps / workbench / app / views / collections / _index_tbody.html.erb
1 <%# Copyright (C) The Arvados Authors. All rights reserved.
2
3 SPDX-License-Identifier: AGPL-3.0 %>
4
5 <% @objects.each do |c| %>
6
7 <tr class="collection" data-object-uuid="<%= c.uuid %>">
8   <td>
9     <%=
10        friendly_name = c.friendly_link_name
11        @collection_info[c.uuid][:tag_links].each do |tag_link|
12          friendly_name += raw(" <span class='label label-info'>#{tag_link.name}</span>")
13        end
14        render partial: "selection_checkbox", locals: {
15          object: c,
16          friendly_name: friendly_name
17        }
18     %>
19
20     <%= render :partial => "show_object_button", :locals => {object: c, size: 'xs'} %>
21   </td>
22   <td>
23     <%= c.uuid %>
24   </td>
25   <td>
26     <% i = 0 %>
27     <% while i < 3 and i < c.files.length %>
28       <% file = c.files[i] %>
29       <% file_path = "#{file[0]}/#{file[1]}" %>
30       <%= link_to file[1], {controller: 'collections', action: 'show_file', uuid: c.uuid, file: file_path, size: file[2], disposition: 'inline'}, {title: 'View in browser'} %><br />
31       <% i += 1 %>
32     <% end %>
33     <% if i < c.files.length %>
34       &vellip;
35     <% end %>
36   </td>
37   <td>
38     <%= c.created_at.to_s if c.created_at %>
39   </td>
40   <td class="add-tag-button">
41     <a class="btn btn-xs btn-info add-tag-button pull-right" data-remote-href="<%= url_for(controller: 'links', action: 'create') %>" data-remote-method="post"><i class="glyphicon glyphicon-plus"></i>&nbsp;Add</a>
42     <span class="removable-tag-container">
43     <% if @collection_info[c.uuid] %>
44       <% @collection_info[c.uuid][:tag_links].each do |tag_link| %>
45         <span class="label label-info removable-tag" data-tag-link-uuid="<%= tag_link.uuid %>"><%= tag_link.name %>
46           <% if tag_link.owner_uuid == current_user.andand.uuid %>
47           &nbsp;<a title="Delete tag"><i class="glyphicon glyphicon-trash"></i></a>
48           <% end %>
49         </span>&nbsp;
50       <% end %>
51     <% end %>
52     </span>
53   </td>
54 </tr>
55
56 <% end %>