Add missing JSON/XML responses.

* GET    /bans.json
* GET    /bans/1.json
* GET    /ip_bans.json
* POST   /ip_bans.json
* DELETE /ip_bans.json
* GET    /mod_actions.json
* GET    /posts/1/events.json
* POST   /saved_searches.json
* DELETE /saved_searches/1.json
* GET    /super_voters.json
This commit is contained in:
evazion
2016-10-16 08:06:08 -05:00
parent 1d8341e1ac
commit af7abc2b38
6 changed files with 16 additions and 6 deletions

View File

@@ -1,5 +1,6 @@
class BansController < ApplicationController
before_filter :moderator_only, :except => [:show, :index]
respond_to :html, :xml, :json
def new
@ban = Ban.new(params[:ban])
@@ -12,10 +13,12 @@ class BansController < ApplicationController
def index
@search = Ban.search(params[:search]).order("id desc")
@bans = @search.paginate(params[:page], :limit => params[:limit])
respond_with(@bans)
end
def show
@ban = Ban.find(params[:id])
respond_with(@ban)
end
def create

View File

@@ -1,4 +1,5 @@
class IpBansController < ApplicationController
respond_to :html, :xml, :json
before_filter :moderator_only
def new
@@ -7,21 +8,18 @@ class IpBansController < ApplicationController
def create
@ip_ban = IpBan.create(params[:ip_ban])
if @ip_ban.errors.any?
render :action => "new"
else
redirect_to ip_bans_path
end
respond_with(@ip_ban)
end
def index
@search = IpBan.search(params[:search])
@ip_bans = @search.order("id desc").paginate(params[:page], :limit => params[:limit])
respond_with(@ip_bans)
end
def destroy
@ip_ban = IpBan.find(params[:id])
@ip_ban.destroy
respond_with(@ip_ban)
end
end

View File

@@ -1,5 +1,8 @@
class ModActionsController < ApplicationController
respond_to :html, :xml, :json
def index
@mod_actions = ModAction.search(params[:search]).order("id desc").paginate(params[:page], :limit => params[:limit])
respond_with(@mod_actions)
end
end

View File

@@ -1,7 +1,9 @@
class PostEventsController < ApplicationController
before_filter :member_only
respond_to :html, :xml, :json
def index
@events = PostEvent.find_for_post(params[:post_id])
respond_with(@events)
end
end

View File

@@ -26,11 +26,13 @@ class SavedSearchesController < ApplicationController
CurrentUser.disable_categorized_saved_searches = true
CurrentUser.save
end
respond_with(@saved_search)
end
def destroy
@saved_search = saved_searches.find(params[:id])
@saved_search.destroy
respond_with(@saved_search)
end
def edit

View File

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