<div class="row my-3">
  <div class="col">
    <ul class="nav nav-pills">
      <li class="nav-item">
        <%= link_to "All", internal_users_path, class: "nav-link #{'active' if params[:role].blank?}" %>
      </li>
      <li class="nav-item">
        <%= link_to "Admins", internal_users_path(role: :admin), class: "nav-link #{'active' if params[:role] == 'admin'}" %>
      </li>
      <li class="nav-item">
        <%= link_to "Super Admins", internal_users_path(role: :super_admin), class: "nav-link #{'active' if params[:role] == 'super_admin'}" %>
      </li>
      <li class="nav-item">
        <%= link_to "Trusted", internal_users_path(role: :trusted), class: "nav-link #{'active' if params[:role] == 'trusted'}" %>
      </li>
      <li class="nav-item">
        <%= link_to "Tag Mods", internal_users_path(role: :tag_moderator), class: "nav-link #{'active' if params[:role] == 'tag_moderator'}" %>
      </li>
    </ul>
  </div>
  <div class="col">
    <%= form_with url: internal_users_path, method: :get, local: true, class: "form-inline justify-content-end" do |f| %>
      <div class="form-group mx-sm-3">
        <%= f.text_field :search, value: params[:search], class: "form-control" %>
        <%= f.hidden_field :role, value: params[:role] if params[:role].present? %>
      </div>
      <%= f.submit "Search", class: "btn btn-light" %>
    <% end %>
  </div>
</div>

<%= paginate @users, theme: "internal" %>

<table class="table table-hover">
  <thead>
    <tr>
      <th scope="col">User</th>
      <th scope="col">ID</th>
      <th scope="col">Name</th>
      <th scope="col">Twitter</th>
      <th scope="col">GitHub</th>
      <th scope="col">Email</th>
    </tr>
  </thead>
  <tbody>
    <% @users.each do |user| %>
    <tr>
      <td><%= link_to user.username, internal_user_path(user) %></td>
      <td><%= user.id %></td>
      <td><%= user.name %></td>
      <td><%= user_twitter_link(user) %></td>
      <td><%= user_github_link(user) %></td>
      <td><%= user.email %></td>
    </tr>
    <% end %>
  </tbody>
</table>

<%= paginate @users, theme: "internal" %>
