ensl.org/app/views/users/index.html.erb
2014-04-28 00:16:28 +01:00

51 lines
1.4 KiB
Text

<h1 class="title">Listing Users</h1>
<p>Search for users by name or Steam ID:</p>
<%= form_tag(users_path, method: 'get', class: 'square search') do %>
<%= hidden_field_tag :direction, params[:direction] %>
<%= hidden_field_tag :sort, params[:sort] %>
<div class="fields query">
<%= text_field_tag :search, params[:search] %>
</div>
<div class="controls">
<%= submit_tag "Search", name: nil %>
</div>
<% end %>
<%= will_paginate @users %>
<table id="users" class="striped">
<tr>
<th class="country"></th>
<th class="username">Username</th>
<th class="name">Name</th>
<th class="steamid">Steam ID</th>
<th class="age">Age</th>
<% if cuser and cuser.admin? %>
<th class="actions"></th>
<% end %>
</tr>
<% @users.each do |user| %>
<tr>
<td><%= flag user.country %></td>
<td><%= link_to (h user.username), user %></td>
<td><%= h user.firstname %> <%=h user.lastname %></td>
<td><%= h user.steamid %></td>
<td><%= user.age %></td>
<% if cuser and cuser.admin? %>
<td class="actions">
<%= link_to edit_user_path(user) do %>
<%= icon 'pencil' %>
<% end %>
<%= link_to user, confirm: "Proceed to delete?", method: :delete do %>
<%= icon 'times' %>
<% end %>
</td>
<% end %>
</tr>
<% end %>
</table>
<%= will_paginate @users %>