robertgauld/OSMExtender

View on GitHub
app/views/users/_users.html.erb

Summary

Maintainability
Test Coverage
<table>
  <tr>
    <th><%= sortable_link 'id', 'ID' %></th>
    <th></th>
    <th><%= sortable_link 'name' %></th>
    <th><%= sortable_link 'email_address' %></th>
    <th>Actions</th>
    <th>Login<br/>Locked?</th> 
    <th>Connected<br/>to OSM?</th>
    <th>Automation<br/>Tasks</TH>
    <th>Email<br/>reminders</th>
    <th>Email<br/>lists</th>
  </tr>
  <%- @users.each do |user| %>
    <tr>
      <td><%= user.id %></td>
      <td><%= image_tag "https://secure.gravatar.com/avatar/#{user.gravatar_id}?size=80&default=identicon".html_safe, :size=>'80x80', :alt=>"#{user.name}'s gravatar" %></td>
      <td><%= user.name %></td>
      <td><%= user.email_address %></td>
      <td>
        <%- if can? :edit, user %>
          <%= link_to 'Edit user', edit_user_path(user) %><br/>
        <%- end %>
        <%- if can? :reset_password, user %>
          <%= link_to 'Reset password', reset_password_user_path(user) %><br/>
        <%- end %>
        <%- if can? :resend_activation, user %>
          <%= link_to 'Resend activation email', resend_activation_user_path(user) %><br/>
        <%- end %>
        <%- if user.login_locked? && can?(:unlock, user) %>
          <%= link_to 'Unlock user', unlock_user_path(user), :method=>:post %><br/>
        <%- end %>
        <%- if can? :become, user %>
          <%= link_to 'Become user', become_user_path(user), :method => :post %><br/>
        <%- end %>
        <%- if can? :delete, user %>
          <%= link_to 'Delete user', user, data: {:confirm => 'Are you sure?'}, method: :delete %>
        <%- end %>
      </td>
      <td>
        <%= yes_no user.login_locked?, false %>
        <%- if user.login_locked? %>
          <br/><%= user.lock_expires_at %>
          <br/><%= distance_of_time_in_words_to_now(user.lock_expires_at) %> remaining
        <%- end %>
      </td>
      <td><%= yes_no user.connected_to_osm? %></td>
      <td><%= user.automation_tasks.count %></td>
      <td><%= user.email_reminders.count %></td>
      <td><%= user.email_lists.count %></td>
    </tr>
  <%- end %>
</table>

<br/>

<%= will_paginate @users %>