emails: add /emails index page.
Add emails index page at https://danbooru.donmai.us/emails. Mods can use this page to view and search emails belonging to users below mod level.
This commit is contained in:
32
app/views/emails/index.html.erb
Normal file
32
app/views/emails/index.html.erb
Normal file
@@ -0,0 +1,32 @@
|
||||
<div id="c-emails">
|
||||
<div id="a-index">
|
||||
<%= search_form_for(emails_path) do |f| %>
|
||||
<%= f.simple_fields_for :user do |fa| %>
|
||||
<%= fa.input :name, label: "User Name", input_html: { value: params.dig(:search, :user, :name), "data-autocomplete": "user" } %>
|
||||
<% end %>
|
||||
|
||||
<%= f.input :address_ilike, label: "Address", input_html: { value: params[:search][:address] }, hint: "Use * for wildcard" %>
|
||||
<%= f.input :is_verified, label: "Verified?", collection: %w[Yes No], selected: params[:search][:is_verified] %>
|
||||
<%= f.submit "Search" %>
|
||||
<% end %>
|
||||
|
||||
<%= table_for @email_addresses, class: "striped autofit" do |t| %>
|
||||
<% t.column :user do |email| %>
|
||||
<%= link_to_user email.user %>
|
||||
<% end %>
|
||||
<% t.column :address %>
|
||||
<% t.column :is_verified, name: "Verified?" do |email| %>
|
||||
<% if email.is_verified? %>
|
||||
<%= link_to "Yes", emails_path(search: { is_verified: true }) %>
|
||||
<% else %>
|
||||
<%= link_to "No", emails_path(search: { is_verified: false }) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% t.column :updated_at, name: "Updated" do |email| %>
|
||||
<%= time_ago_in_words_tagged(email.updated_at) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= numbered_paginator(@email_addresses) %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -154,6 +154,10 @@
|
||||
<li><%= link_to("Moderation Reports", moderation_reports_path) %></li>
|
||||
<% end %>
|
||||
|
||||
<% if policy(EmailAddress).index? %>
|
||||
<li><%= link_to("Email Addresses", emails_path) %></li>
|
||||
<% end %>
|
||||
|
||||
<% if policy(IpAddress).index? %>
|
||||
<li><%= link_to("IP Addresses", ip_addresses_path) %></li>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user