d94dd84be4d3a13b7da3b6facfb4264b39b7284a
[arvados.git] / apps / workbench / app / views / application / _show_recent.html.erb
1 <% if objects.empty? %>
2 <br/>
3 <p style="text-align: center">
4   No <%= controller.controller_name.humanize.downcase %> to display.
5 </p>
6
7 <% else %>
8
9 <% attr_blacklist = ' created_at modified_at modified_by_user_uuid modified_by_client_uuid updated_at owner_uuid group_class' %>
10
11 <%= render partial: "paging", locals: {results: objects, object: @object} %>
12
13 <%= form_tag do |f| %>
14
15 <table class="table table-condensed arv-index">
16   <thead>
17     <tr>
18       <% if objects.first and objects.first.class.goes_in_projects? %>
19         <th></th>
20       <% end %>
21       <th></th>
22       <% objects.first.attributes_for_display.each do |attr, attrvalue| %>
23       <% next if attr_blacklist.index(" "+attr) %>
24       <th class="arv-attr-<%= attr %>">
25         <%= controller.model_class.attribute_info[attr.to_sym].andand[:column_heading] or attr.sub /_uuid/, '' %>
26       </th>
27       <% end %>
28       <th>
29         <!-- a column for delete buttons -->
30       </th>
31     </tr>
32   </thead>
33       
34   <tbody>
35     <% objects.each do |object| %>
36     <tr data-object-uuid="<%= object.uuid %>">
37       <% if objects.first.class.goes_in_projects? %>
38         <td>
39           <%= render :partial => "selection_checkbox", :locals => {:object => object} %>
40         </td>
41       <% end %>
42       <td>
43         <%= render :partial => "show_object_button", :locals => {object: object, size: 'xs'} %>
44       </td>
45
46       <% object.attributes_for_display.each do |attr, attrvalue| %>
47       <% next if attr_blacklist.index(" "+attr) %>
48       <td class="arv-object-<%= object.class.to_s %> arv-attr-<%= attr %>">
49         <% if attr == 'uuid' %>
50         <span class="arvados-uuid"><%= attrvalue %></span>
51         <% else %>
52         <% if object.attribute_editable? attr %>
53         <%= render_editable_attribute object, attr %>
54         <% else %>
55         <%= resource_class_for_uuid(attrvalue, referring_attr: attr, referring_object: @object).to_s %>
56         <%= attrvalue %>
57         <% end %>
58         <%= link_to_if_arvados_object(attrvalue, { referring_object: @object, link_text: raw('<i class="icon-hand-right"></i>') }) if resource_class_for_uuid(attrvalue, {referring_object: @object}) %>
59         <% end %>
60       </td>
61       <% end %>
62       <td>
63         <%= render partial: 'delete_object_button', locals: {object:object} %>
64       </td>
65     </tr>
66     <% end %>
67   </tbody>
68
69   <tfoot>
70   </tfoot>
71 </table>
72
73 <% end %>
74
75 <%= render partial: "paging", locals: {results: objects, object: @object} %>
76
77 <% end %>