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

85 lines
3.4 KiB
Plaintext
Raw Normal View History

<h1>HeatSync People</h1>
<% if can? :create, User %>
2013-10-06 02:53:31 +00:00
<%= link_to 'New User', new_user_path %> |
<% end %>
<% if can? :manage, User %>
2013-10-06 02:53:31 +00:00
<%= link_to 'Merge Users', users_merge_path %> |
<% end %>
<% if current_user.admin? %>
2013-10-06 02:53:31 +00:00
<%= link_to 'Inactive Users', users_inactive_path %> |
<%= link_to 'Recent Activity', users_activity_path %> |
<% end %>
2013-10-06 02:53:31 +00:00
<%= link_to 'New Members Report', users_new_member_report_path %>
2013-09-24 03:24:38 +00:00
<% @certifications = Certification.all.sort_by(&:id) %>
<table>
<col />
<col />
2013-01-25 18:11:39 +00:00
<% if current_user.admin? then %><col /><% end %>
2013-09-24 03:24:38 +00:00
<col class="col_highlight" />
2013-02-12 08:58:17 +00:00
<% if current_user.admin? %><col />
<col class="col_highlight" /><% end %>
<col />
<col class="col_highlight" />
<col />
2013-09-24 03:24:38 +00:00
<% col_count = 0 %>
<% @certifications.each do |c| %>
<col <% if col_count.even? %>class="col_highlight"<% end %> />
<% col_count = col_count + 1 %>
<% end %>
<tr>
<th></th>
2013-01-25 18:11:39 +00:00
<th><a href="?sort=name">Name</a></th>
2013-09-24 03:24:38 +00:00
<th><a href="?sort=member">Member?</a></th>
2013-01-25 18:11:39 +00:00
<% if current_user.admin? then %><th><a href="?sort=email">Email</a></th><% end %>
<% if current_user.admin? then %>
2013-01-25 18:11:39 +00:00
<th><a href="?sort=orientation">Orientation?</a></th>
<% end %>
2013-01-25 18:11:39 +00:00
<th><a href="?sort=waiver">Waiver?</a></th>
<th><a href="?sort=card">Card?</a></th>
<th><a href="?sort=instructor">Instructor?</a></th>
2013-02-12 08:58:17 +00:00
<% if current_user.admin? then %><th><a href="?sort=admin">Admin?</a></th><% end %>
2013-09-24 03:24:38 +00:00
<% @certifications.each do |c| %>
<th><a href="?sort=cert&cert=<%= c.id %>"><%= c.name %></a></th>
<% end %>
<th></th>
<th></th>
</tr>
<% if !@users.blank? %>
<% @users.each do |user| %>
<tr<%= " class='hidden'" if user.hidden? %>>
<td><%= image_tag user.gravatar_url(:default => "http://members.heatsynclabs.org/assets/nil.png"), :class => :avatar %></td>
<td><%= link_to user.name, user %></td>
2013-09-24 03:24:38 +00:00
<td><%= raw(user.member_status_symbol) %></td>
2013-01-25 18:11:39 +00:00
<% if current_user.admin? then %><td><%= user.email %></td><% end %>
<% 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><%= unless user.waiver.blank? then raw("<span class='hoverinfo' title='"+user.waiver.strftime("%B %d %Y")+"'>&#x2713;</span>") end %></td>
<td><%= unless user.cards.blank? then raw("<span class='iconinfo'>&#x2713;</span>") end %></td>
<td><%= if user.instructor? then raw("<span class='iconinfo'>&#x2713;</a>") end %></td>
2013-02-12 08:58:17 +00:00
<% if current_user.admin? then %><td><%= if user.admin? then raw("<span class='iconinfo'>&#x2713;</a>") end %></td><% end %>
2013-09-24 03:24:38 +00:00
<% @certifications.each do |c| %>
<td>
<% user.user_certifications.each do |u| %>
<% if u.certification_id == c.id %>
<%= link_to raw("<span class='iconinfo'>&#x2713;</span>"), u %>
<% end %>
<% end %>
</td>
<% end %>
<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>
<% if current_user.orientation.blank? then %>
<p class="alert">There's a lot more to see here, but our records show you haven't completed the new member orientation yet. If that's incorrect, please contact a volunteer.</p>
<% end %>
<br />