deba78e47b7f2723b2fa10da36a7674b357a123f
[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
11     <%= render :partial => "show_object_button", :locals => {object: c, size: 'xs'} %>
12   </td>
13   <td>
14     <%= c.uuid %>
15   </td>
16   <td>
17     <% i = 0 %>
18     <% while i < 3 and i < c.files.length %>
19       <% file = c.files[i] %>
20       <% file_path = "#{file[0]}/#{file[1]}" %>
21       <%= 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 />
22       <% i += 1 %>
23     <% end %>
24     <% if i < c.files.length %>
25       &vellip;
26     <% end %>
27   </td>
28   <td>
29     <%= raw(distance_of_time_in_words(c.created_at, Time.now).sub('about ','~').sub(' ','&nbsp;')) if c.created_at %>
30   </td>
31   <td>
32     <% current_state = @collection_info[c.uuid][:wanted_by_me] ? 'persistent' : 'cache' %>
33     <%= render partial: 'toggle_persist', locals: { uuid: c.uuid, current_state: current_state } %>
34   </td>
35   <td class="add-tag-button">
36     <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>
37     <span class="removable-tag-container">
38     <% if @collection_info[c.uuid] %>
39       <% @collection_info[c.uuid][:tag_links].each do |tag_link| %>
40         <span class="label label-info removable-tag" data-tag-link-uuid="<%= tag_link.uuid %>"><%= tag_link.name %>
41           <% if tag_link.owner_uuid == current_user.uuid %>
42           &nbsp;<a title="Delete tag"><i class="glyphicon glyphicon-trash"></i></a>
43           <% end %>
44         </span>&nbsp;
45       <% end %>
46     <% end %>
47     </span>
48   </td>
49 </tr>
50
51 <% end %>