docbrown/app/views/admin/mods/index.html.erb
Ridhwana 7ffda62119
Override specified line break behaviour on the ID column (#12076)
* feat: add a utility class to override the specified line break behaviour on the ID column.

* chore: revert previous change

* Revert "chore: revert previous change"

This reverts commit 5be6f5ff8adb8476e5b90931a8dd6bcb9559fcc8.

* feat: add some more whitespace

* feat: add a max width
2021-01-04 16:17:38 -05:00

61 lines
2.3 KiB
Text

<div class="mb-6 flex items-center">
<ul class="nav nav-pills">
<li class="nav-item">
<%= link_to "General Community", admin_mods_path, class: "nav-link #{'active' if params[:state].blank?}" %>
</li>
<li class="nav-item">
<%= link_to "Tag Mods", admin_mods_path(state: :tag_moderator), class: "nav-link #{'active' if params[:state] == 'tag_moderator'}" %>
</li>
<li class="nav-item">
<%= link_to "Potential Mods", admin_mods_path(state: :potential), class: "nav-link #{'active' if params[:state] == 'potential'}" %>
</li>
</ul>
<%= form_with url: admin_mods_path, method: :get, local: true, class: "form-inline ml-auto" do |f| %>
<div class="form-group mx-sm-3">
<%= f.text_field :search, value: params[:search], class: "form-control", aria: { label: "Search" } %>
<%= f.hidden_field :state, value: params[:state] if params[:state].present? %>
</div>
<%= f.submit "Search", class: "btn btn-light" %>
<% end %>
</div>
<% if @mods.empty? %>
<div class="alert alert-warning">There are no mods matching your search criteria.</div>
<% else %>
<%= paginate @mods, theme: "internal" %>
<table class="crayons-table" width="100%">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Profile</th>
<th scope="col">Comments</th>
<th scope="col">Badges</th>
<th scope="col">Last Comment</th>
<% if params[:state] == "potential" %>
<th scope="col">Action</th>
<% end %>
</tr>
</thead>
<tbody class="crayons-card">
<% @mods.each do |mod| %>
<tr>
<td class="whitespace-nowrap"><%= mod.id %></td>
<td><%= link_to mod.username, admin_user_path(mod.id) %></td>
<td><%= mod.comments_count %></td>
<td><%= mod.badge_achievements_count %></td>
<td><%= time_ago_in_words mod.last_comment_at %> ago</td>
<% if params[:state] == "potential" %>
<td>
<%= form_with model: [:admin, mod], url: admin_mod_path(mod.id), method: :patch, local: true do |f| %>
<%= f.submit "Make Trusted", class: "crayons-btn crayons-btn--secondary js-add-to-mod-channel" %>
<% end %>
</td>
<% end %>
</tr>
<% end %>
</tbody>
</table>
<%= paginate @mods, theme: "internal" %>
<% end %>