thedrummeraki/tanoshimu

View on GitHub
app/views/admin/users/index.html.erb

Summary

Maintainability
Test Coverage
<div class="container">
  <h1 class="title">Users List</h1>
  <div class="table-container">
    <table class="table is-fullwidth">
      <thead>
        <tr>
          <th>Action</th>
          <th>ID</th>
          <th>Username</th>
          <th>Name</th>
          <th>Email</th>
          <th>User Type</th>
          <th>Color</th>
          <th>Status</th>
        </tr>
      </thead>
      <tbody>
        <% @users.each do |user| %>
          <tr>
            <% if user.is_a?(GraphqlUser) %>
              <td>-</td>
              <td><%= user.uuid %></td>
              <td>-</td>
              <td>-</td>
              <td>-</td>
              <td title="OAuth user">OAuth user</td>
              <td>-</td>
              <td>-</td>
            <% else %>
              <td><%= link_to 'View', admin_users_path(user), class: 'button is-primary is-small' %></td>
              <td><%= user.id %></td>
              <td><%= user.username %></td>
              <td><%= user.name %></td>
              <td><%= user.email.presence || '-' %></td>
              <td title="<%= user.type %>"><%= user_type(user) %></td>
              <td><%= user_color(user) %></td>
              <td><%= user_status(user) %></td>
            <% end %>
          </tr>
        <% end %>
      </tbody>
    </table>
  </div>
</div>