refs #2871
[arvados.git] / apps / workbench / app / views / collections / _index_tbody.html.erb
1 <% @collections.each do |c| %>
2
3 <tr class="collection" data-object-uuid="<%= c.uuid %>">
4   <td>
5     <% friendly_name = c.friendly_link_name  %>
6     <% @collection_info[c.uuid][:tag_links].each do |tag_link| %>
7       <% friendly_name += raw(" <span class='label label-info'>#{tag_link.name}</span>") %>
8     <% end %>
9     <%= render :partial => "selection_checkbox", :locals => {:object => c, :friendly_name => friendly_name} %>
10   </td>
11   <td>
12     <%= link_to_if_arvados_object c.uuid, {:no_tags => true } %>
13   </td>
14   <td>
15     <% i = 0 %>
16     <% while i < 3 and i < c.files.length %>
17       <% file = c.files[i] %>
18       <% file_path = "#{file[0]}/#{file[1]}" %>
19       <%= 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 />
20       <% i += 1 %>
21     <% end %>
22     <% if i < c.files.length %>
23       &vellip;
24     <% end %>
25   </td>
26   <td>
27     <%= raw(distance_of_time_in_words(c.created_at, Time.now).sub('about ','~').sub(' ','&nbsp;')) if c.created_at %>
28   </td>
29   <td>
30     <% current_state = @collection_info[c.uuid][:wanted_by_me] ? 'persistent' : 'cache' %>
31     <%= render partial: 'toggle_persist', locals: { uuid: c.uuid, current_state: current_state } %>
32   </td>
33   <td class="add-tag-button">
34     <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>
35     <span class="removable-tag-container">
36     <% if @collection_info[c.uuid] %>
37       <% @collection_info[c.uuid][:tag_links].each do |tag_link| %>
38         <span class="label label-info removable-tag" data-tag-link-uuid="<%= tag_link.uuid %>"><%= tag_link.name %>
39           <% if tag_link.owner_uuid == current_user.uuid %>
40           &nbsp;<a title="Delete tag"><i class="glyphicon glyphicon-trash"></i></a>
41           <% end %>
42         </span>&nbsp;
43       <% end %>
44     <% end %>
45     </span>
46   </td>
47 </tr>
48
49 <% end %>