rename foreign uuid attributes
[arvados.git] / apps / workbench / app / views / application / _index.html.erb
1 <% if @objects.empty? %>
2
3 <p>
4   No <%= controller.model_class.to_s.underscore.pluralize.gsub '_', ' ' %> 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' %>
10
11 <table class="table arv-index">
12   <thead>
13     <tr>
14       <% @objects.first.attributes_for_display.each do |attr, attrvalue| %>
15       <% next if attr_blacklist.index attr %>
16       <th class="arv-attr-<%= attr %>">
17         <%= controller.model_class.attribute_info[attr.to_sym].andand[:column_heading] or attr.sub /_uuid/, '' %>
18       </th>
19       <% end %>
20     </tr>
21   </thead>
22       
23   <tbody>
24     <% @objects.each do |object| %>
25     <tr>
26       <% object.attributes_for_display.each do |attr, attrvalue| %>
27       <% next if attr_blacklist.index attr %>
28       <td class="arv-object-<%= object.class.to_s %> arv-attr-<%= attr %>">
29         <% if attr == 'uuid' %>
30         <%= link_to_if_arvados_object object %>
31         <% elsif object.attribute_editable? attr %>
32         <%= render_editable_attribute object, attr %>
33         <% else %>
34         <%= link_to_if_arvados_object attrvalue, {referring_attr: attr, referring_object: @object, with_class_name: true} %>
35         <% end %>
36       </td>
37       <% end %>
38     </tr>
39     <% end %>
40   </tbody>
41
42   <tfoot>
43   </tfoot>
44 </table>
45
46 <% end %>
47
48 <% if controller.model_class.creatable? %>
49 <%= button_to "Add a new #{controller.model_class.to_s.underscore.gsub '_', ' '}", { action: 'create', return_to: './' }, { class: 'btn btn-primary' } %>
50 <% end %>