index.html.erb 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <% content_for :title, "Users" -%>
  2. <div class='container'>
  3. <div class='row'>
  4. <div class='col-md-12'>
  5. <div class="page-header">
  6. <h2>
  7. Users
  8. </h2>
  9. </div>
  10. <div class='table-responsive'>
  11. <table class='table table-striped events'>
  12. <tr>
  13. <th>Username</th>
  14. <th>Email</th>
  15. <th>State</th>
  16. <th>Active agents</th>
  17. <th>Deactivated agents</th>
  18. <th>Registered since</th>
  19. <th>Options</th>
  20. </tr>
  21. <% @users.each do |user| %>
  22. <tr>
  23. <td><%= link_to user.username, edit_admin_user_path(user) %></td>
  24. <td><%= user.email %></td>
  25. <td><%= user_account_state(user) %></td>
  26. <td><%= link_to user.agents.active.count, switch_to_user_admin_user_path(user), data: { confirm: 'This will log you in as another user. Would you like to continue?' } %></td>
  27. <td><%= link_to user.agents.inactive.count, switch_to_user_admin_user_path(user), data: { confirm: 'This will log you in as another user. Would you like to continue?' } %></td>
  28. <td title='<%= user.created_at %>'><%= time_ago_in_words user.created_at %> ago</td>
  29. <td>
  30. <div class="btn-group btn-group-xs">
  31. <% if user != current_user %>
  32. <% if user.active? %>
  33. <%= link_to 'Become User', switch_to_user_admin_user_path(user), class: "btn btn-default", data: { confirm: 'This will log you in as another user. Would you like to continue?' } %>
  34. <%= link_to 'Deactivate', deactivate_admin_user_path(user), method: :put, class: "btn btn-default" %>
  35. <% else %>
  36. <%= link_to 'Activate', activate_admin_user_path(user), method: :put, class: "btn btn-default" %>
  37. <% end %>
  38. <%= link_to 'Delete', admin_user_path(user), method: :delete, data: { confirm: 'Are you sure? This can not be undone.' }, class: "btn btn-default" %>
  39. <% end %>
  40. </div>
  41. </td>
  42. </tr>
  43. <% end %>
  44. </table>
  45. </div>
  46. <%= paginate @users, theme: 'twitter-bootstrap-3' %>
  47. <div class="btn-group">
  48. <%= link_to icon_tag('glyphicon-plus') + ' New User', new_admin_user_path, class: "btn btn-default" %>
  49. </div>
  50. </div>
  51. </div>
  52. </div>