Merge pull request #3018 from evazion/fix-user-search

Add search options for approvers/super voters/contributors
This commit is contained in:
Albert Yi
2017-05-03 15:33:33 -07:00
committed by GitHub
4 changed files with 10 additions and 47 deletions

View File

@@ -1,8 +0,0 @@
class SuperVotersController < ApplicationController
respond_to :html, :xml, :json
def index
@super_voters = SuperVoter.all
respond_with(@super_voters)
end
end

View File

@@ -109,7 +109,6 @@
<li><%= link_to("Signup", new_user_path) %></li>
<li><%= link_to("Terms of Service", terms_of_service_path) %></li>
<li><%= link_to("Upgrade Information", new_user_upgrade_path) %></li>
<li><%= link_to("Super Voters", super_voters_path) %></li>
</ul>
<ul>
<li><h1>Admin</h1></li>

View File

@@ -1,17 +0,0 @@
<div id="c-super-voters">
<div id="a-index">
<h1>Super Voters</h1>
<p>The following users will increment or decrement a post's score by <%= SuperVoter::MAGNITUDE %> when they vote. This list is regenerated once a week.</p>
<ul>
<% @super_voters.each do |super_voter| %>
<li><%= link_to_if CurrentUser.user.is_moderator?, super_voter.user.name, posts_path(tags: "upvote:#{super_voter.user.name}") %></li>
<% end %>
</ul>
</div>
</div>
<% content_for(:page_title) do %>
Super Voters - <%= Danbooru.config.app_name %>
<% end %>

View File

@@ -1,29 +1,18 @@
<div id="c-users">
<div id="a-search">
<%= form_tag(users_path, :method => :get, :class => "simple_form") do %>
<%= search_field "name_matches", :label => "Name" %>
<%= simple_form_for(:search, url: users_path, method: :get, defaults: { required: false }, html: { class: "inline-form" }) do |f| %>
<%= f.input :name_matches, label: "Name", hint: "Use * for wildcard", input_html: { value: params[:search][:name_matches] } %>
<div class="input">
<label for="search_level">Level</label>
<%= select("search", "level", [""] + User.level_hash.to_a) %>
</div>
<%= f.input :level, collection: User.level_hash.to_a, include_blank: true, selected: params[:search][:level] %>
<%= f.input :min_level, collection: User.level_hash.to_a, include_blank: true, selected: params[:search][:min_level] %>
<%= f.input :max_level, collection: User.level_hash.to_a, include_blank: true, selected: params[:search][:max_level] %>
<div class="input">
<label for="search_min_level">Min Level</label>
<%= select("search", "min_level", [""] + User.level_hash.to_a) %>
</div>
<%= f.input :can_upload_free, label: "Unrestricted uploads?", collection: [%w[Yes true], %w[No false]], include_blank: true, selected: params[:search][:can_upload_free] %>
<%= f.input :can_approve_posts, label: "Approver?", collection: [%w[Yes true], %w[No false]], include_blank: true, selected: params[:search][:can_approve_posts] %>
<%= f.input :is_super_voter, label: "Super voter?", collection: [%w[Yes true], %w[No false]], include_blank: true, selected: params[:search][:is_super_voter] %>
<div class="input">
<label for="search_max_level">Max Level</label>
<%= select("search", "max_level", [""] + User.level_hash.to_a) %>
</div>
<div class="input">
<label for="search_order">Order</label>
<%= select("search", "order", [["Join date", "date"], ["Name", "name"], ["Upload count", "post_upload_count"], ["Note count", "note_count"], ["Post update count", "post_update_count"]]) %>
</div>
<%= submit_tag "Search" %>
<%= f.input :order, collection: [["Join date", "date"], ["Name", "name"], ["Upload count", "post_upload_count"], ["Note count", "note_count"], ["Post update count", "post_update_count"]], selected: params[:search][:order] %>
<%= f.submit "Search" %>
<% end %>
</div>
</div>