This commit is contained in:
r888888888
2018-05-26 13:13:07 -07:00
parent 97887a3241
commit 4739c45da0
5 changed files with 9 additions and 0 deletions

View File

@@ -1,10 +1,12 @@
module Moderator
class IpAddrsController < ApplicationController
before_action :moderator_only
respond_to :html, :json
def index
@search = IpAddrSearch.new(params[:search])
@results = @search.execute
respond_with(@results)
end
def search

View File

@@ -0,0 +1 @@
<%= raw @results.map {|ip_addr, count| {ip_addr: ip_addr.to_s, count: count}}.to_json %>

View File

@@ -0,0 +1 @@
<%= raw @results.map {|user, count| {user_id: user.id, count: count}}.to_json %>

View File

@@ -0,0 +1,5 @@
<% if params[:search][:user_id].present? || params[:search][:user_name].present? %>
<%= render "ip_listing.json" %>
<% else %>
<%= render "user_listing.json" %>
<% end %>