6880: Omit delete button from users index table; add controller tests.
[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 properties' %>
10
11 <% show_home_link = (current_user.is_admin and controller.model_class == User) %>
12 <% show_delete_btn = (controller.model_class != User) %>
13
14 <%= render partial: "paging", locals: {results: objects, object: @object} %>
15
16 <%= form_tag do |f| %>
17
18 <table class="table table-condensed arv-index">
19   <thead>
20     <tr>
21       <% if objects.first and objects.first.class.goes_in_projects? %>
22         <th></th>
23       <% end %>
24       <th></th>
25       <% objects.first.attributes_for_display.each do |attr, attrvalue| %>
26       <% next if attr_blacklist.index(" "+attr) %>
27       <th class="arv-attr-<%= attr %>">
28         <%= controller.model_class.attribute_info[attr.to_sym].andand[:column_heading] or attr.sub /_uuid/, '' %>
29       </th>
30       <% end %>
31       <% if show_home_link %>
32         <th class="arv-user-home">
33           <!-- a column for user's home -->
34         </th>
35       <% end %>
36       <th>
37         <!-- a column for delete buttons -->
38       </th>
39     </tr>
40   </thead>
41
42   <tbody>
43     <% objects.each do |object| %>
44     <tr data-object-uuid="<%= object.uuid %>">
45       <% if objects.first.class.goes_in_projects? %>
46         <td>
47           <%= render :partial => "selection_checkbox", :locals => {:object => object} %>
48         </td>
49       <% end %>
50       <td>
51         <%= render :partial => "show_object_button", :locals => {object: object, size: 'xs'} %>
52       </td>
53
54       <% object.attributes_for_display.each do |attr, attrvalue| %>
55       <% next if attr_blacklist.index(" "+attr) %>
56       <td class="arv-object-<%= object.class.to_s %> arv-attr-<%= attr %>">
57         <% if attr == 'uuid' %>
58           <span class="arvados-uuid"><%= attrvalue %></span>
59         <% else %>
60           <%= link_to_if_arvados_object attrvalue, {referring_attr: attr, referring_object: object, with_class_name: true, friendly_name: true} %>
61         <% end %>
62       </td>
63       <% end %>
64       <% if show_home_link %>
65         <td>
66           <%= link_to 'Home', "/projects/#{object.uuid}" %>
67         </td>
68       <% end %>
69       <td>
70         <% if show_delete_btn %>
71           <%= render partial: 'delete_object_button', locals: {object:object} %>
72         <% end %>
73       </td>
74     </tr>
75     <% end %>
76   </tbody>
77
78   <tfoot>
79   </tfoot>
80 </table>
81
82 <% end %>
83
84 <%= render partial: "paging", locals: {results: objects, object: @object} %>
85
86 <% end %>