Improvements and bugfixes refs #2242.
[arvados.git] / apps / workbench / app / views / collections / _index_tbody.html.erb
index f8fbcdc8338c1d95be5f265dfa38fd489dc53502..96b73979eb60a645b69a9be0d67c4fa91d553617 100644 (file)
@@ -1,19 +1,29 @@
 <% @collections.each do |c| %>
 
-<tr class="collection">
+<tr class="collection" data-object-uuid="<%= c.uuid %>">
+  <td>
+    <%= render :partial => "selection_checkbox", :locals => {:object => c} %>
+  </td>
   <td>
     <%= link_to_if_arvados_object c.uuid %>
-  </td><td>
-    <% c.files.each do |file| %>
-      <%= file[0] == '.' ? file[1] : "#{file[0]}/#{file[1]}" %>
+  </td>
+  <td>
+    <% i = 0 %>
+    <% while i < 3 and i < c.files.length %>
+      <% file = c.files[i] %>
+      <% file_path = "#{file[0]}/#{file[1]}" %>
+      <%= 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 />
+      <% i += 1 %>
     <% end %>
-  </td><td>
-    <%= raw(distance_of_time_in_words(c.created_at, Time.now).sub('about ','~').sub(' ','&nbsp;')) if c.created_at %>
-  </td><td>
-    <% if @collection_info[c.uuid] %>
-      <%= @collection_info[c.uuid][:tags].uniq.join ', ' %>
+    <% if i < c.files.length %>
+      &vellip;
     <% end %>
-  </td><td>
+  </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 %>
+  </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">cache</span>
     <% end %>
   </td>
+  <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>
 
 <% end %>