Merge branch 'master' into 3088-project-chooser-on-run-pipeline-template
[arvados.git] / apps / workbench / app / views / collections / _index_tbody.html.erb
index 0a3732a943d88fb1a22f5903dc34c36c95bcc247..ec5a09e3c6a8a1c676cabb74d0f9fc40e75c2770 100644 (file)
@@ -1,11 +1,17 @@
 <% @collections.each do |c| %>
 
-<tr class="collection">
+<tr class="collection" data-object-uuid="<%= c.uuid %>">
   <td>
-    <%= check_box_tag 'uuids[]', c.uuid, false, :class => 'persistent-selection' %>
+    <% friendly_name = c.friendly_link_name  %>
+    <% @collection_info[c.uuid][:tag_links].each do |tag_link| %>
+      <% friendly_name += raw(" <span class='label label-info'>#{tag_link.name}</span>") %>
+    <% end %>
+    <%= render :partial => "selection_checkbox", :locals => {:object => c, :friendly_name => friendly_name} %>
+
+    <%= render :partial => "show_object_button", :locals => {object: c, size: 'xs'} %>
   </td>
   <td>
-    <%= link_to_if_arvados_object c.uuid %>
+    <%= c.uuid %>
   </td>
   <td>
     <% i = 0 %>
       &vellip;
     <% end %>
   </td>
-  <td><%= link_to_if_arvados_object c.owner_uuid, friendly_name: true %></td>
   <td>
-    <%= raw(distance_of_time_in_words(c.created_at, Time.now).sub('about ','~').sub(' ','&nbsp;')) if c.created_at %>
+    <%= c.created_at.to_s if c.created_at %>
   </td>
   <td>
-    <% if @collection_info[c.uuid] %>
-      <%= @collection_info[c.uuid][:tags].uniq.join ', ' %>
-    <% end %>
+    <% current_state = @collection_info[c.uuid][:wanted_by_me] ? 'persistent' : 'cache' %>
+    <%= render partial: 'toggle_persist', locals: { uuid: c.uuid, current_state: current_state } %>
   </td>
-  <td>
-    <% if @collection_info[c.uuid][:wanted_by_me] %>
-      <span class="label label-info">2&times;</span>
-    <% elsif @collection_info[c.uuid][:wanted] %>
-      <span class="label">2&times;</span>
-    <% else %>
-      <span class="label">cache</span>
+  <td class="add-tag-button">
+    <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>
+    <span class="removable-tag-container">
+    <% if @collection_info[c.uuid] %>
+      <% @collection_info[c.uuid][:tag_links].each do |tag_link| %>
+        <span class="label label-info removable-tag" data-tag-link-uuid="<%= tag_link.uuid %>"><%= tag_link.name %>
+          <% if tag_link.owner_uuid == current_user.uuid %>
+          &nbsp;<a title="Delete tag"><i class="glyphicon glyphicon-trash"></i></a>
+          <% end %>
+        </span>&nbsp;
+      <% end %>
     <% end %>
+    </span>
   </td>
 </tr>