docbrown/app/views/admin/mods/index.html.erb
Ridhwana 83afd9f882
Standardize (but also add consistent) headers on the admin (#18936)
* feat: update rubocop to fix some erb_lint errors

* standardize and add headers

* feat: update gemfile

* feat: revert change

* feat: rename gdpr delete requests to gdpr actions

* feat: remove the margin for consistency

* feat: add a skeleton for the api/v1/followers/users spec

* feat: add the operation block

* feat: add two global schema parameters

* feat: add a 'sort' parameter

* feat: add a successful response

* feat: add an unauthorized response

* feat: generate the json

* fix: indentation

* fix: oops remove the spec
2023-01-17 17:07:09 +02:00

63 lines
2.5 KiB
Text

<h1 class="crayons-title mb-3">Mods</h1>
<div class="mb-6 flex items-center flex-col m:flex-row">
<ul class="crayons-navigation crayons-navigation--horizontal">
<li>
<a href="<%= admin_mods_path %>" class="crayons-navigation__item <%= "crayons-navigation__item--current" if params[:state].blank? %>">General Community</a>
</li>
<li>
<a href="<%= admin_mods_path(state: :tag_moderator) %>" class="crayons-navigation__item <%= "crayons-navigation__item--current" if params[:state] == "tag_moderator" %>">Tag Mods</a>
</li>
<li>
<a href="<%= admin_mods_path(state: :potential) %>" class="crayons-navigation__item <%= "crayons-navigation__item--current" if params[:state] == "potential" %>">Potential Mods</a>
</li>
</ul>
<%= form_with url: admin_mods_path, method: :get, local: true, class: "flex mt-4 mx-auto m:ml-auto m:mt-0" do |f| %>
<div class="mx-3">
<%= f.text_field :search, value: params[:search], class: "crayons-textfield", aria: { label: "Search" } %>
<%= f.hidden_field :state, value: params[:state] if params[:state].present? %>
</div>
<%= f.submit "Search", class: "crayons-btn" %>
<% end %>
</div>
<% if @mods.empty? %>
<div class="crayons-notice crayons-notice--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 %>