Open-Source-Access-Control-.../app/views/users/index.html.erb

51 lines
1.7 KiB
Plaintext

<h1>Listing users</h1>
<% if can? :create, User %>
<%= link_to 'New User', new_user_path %>
<% end %>
<table>
<tr>
<th>Name</th>
<th>Email</th>
<% if current_user.admin? then %>
<th>Cards</th>
<% end %>
<th>Certifications</th>
<th>Active?</th>
<th>Waiver?</th>
<% if current_user.admin? then %>
<th>Orientation?</th>
<% end %>
<th>Admin?</th>
<th></th>
<th></th>
</tr>
<% if !@users.blank? %>
<% @users.each do |user| %>
<tr>
<td><%= link_to user.name, user %></td>
<td><%= user.email %></td>
<% if current_user.admin? then %><td>
<% user.cards.each do |c| %>
<%= link_to c.card_number, card_url(c) %><%= "," unless c == user.cards.last %>
<% end %>
</td><% end %>
<td><% user.certifications.each do |c| %>
<%= link_to c.name, c %><%= "," unless c == user.certifications.last %>
<% end %></td>
<td><%= if user.active? then raw("&#x2713;") end %></td>
<td><%= unless user.waiver.blank? then raw("<span class='hoverinfo' title='"+user.waiver.strftime("%B %d %Y")+"'>&#x2713;</span>") end %></td>
<% if current_user.admin? then %><td>
<%= unless user.orientation.blank? then raw("<span class='hoverinfo' title='"+user.orientation.strftime("%B %d %Y")+"'>&#x2713;</span>") end %>
</td><% end %>
<td><%= if user.admin? then raw("&#x2713;") end %></td>
<td><%= link_to 'Edit', edit_user_path(user) if can? :update, user %></td>
<td><%= link_to 'Destroy', user, :confirm => 'Are you sure? WARNING: THIS DOES NOT REMOVE THE USER FROM THE DOOR SYSTEM! DISABLE THEM FIRST.', :method => :delete if can? :destroy, user %></td>
</tr>
<% end %>
<% end %>
</table>
<br />