fixes #3729
This commit is contained in:
@@ -1,10 +1,12 @@
|
|||||||
module Moderator
|
module Moderator
|
||||||
class IpAddrsController < ApplicationController
|
class IpAddrsController < ApplicationController
|
||||||
before_action :moderator_only
|
before_action :moderator_only
|
||||||
|
respond_to :html, :json
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@search = IpAddrSearch.new(params[:search])
|
@search = IpAddrSearch.new(params[:search])
|
||||||
@results = @search.execute
|
@results = @search.execute
|
||||||
|
respond_with(@results)
|
||||||
end
|
end
|
||||||
|
|
||||||
def search
|
def search
|
||||||
|
|||||||
1
app/views/moderator/ip_addrs/_ip_listing.json.erb
Normal file
1
app/views/moderator/ip_addrs/_ip_listing.json.erb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<%= raw @results.map {|ip_addr, count| {ip_addr: ip_addr.to_s, count: count}}.to_json %>
|
||||||
1
app/views/moderator/ip_addrs/_user_listing.json.erb
Normal file
1
app/views/moderator/ip_addrs/_user_listing.json.erb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<%= raw @results.map {|user, count| {user_id: user.id, count: count}}.to_json %>
|
||||||
5
app/views/moderator/ip_addrs/index.json.erb
Normal file
5
app/views/moderator/ip_addrs/index.json.erb
Normal 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 %>
|
||||||
Reference in New Issue
Block a user