Merge pull request #2722 from evazion/fix-2721

Fix missing JSON/XML templates, make more pages public (#2721)
This commit is contained in:
Albert Yi
2016-10-17 14:47:01 -07:00
committed by GitHub
12 changed files with 27 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
class ArtistCommentariesController < ApplicationController class ArtistCommentariesController < ApplicationController
respond_to :html, :xml, :json, :js respond_to :html, :xml, :json, :js
before_filter :member_only before_filter :member_only, :except => [:index]
def index def index
@commentaries = ArtistCommentary.search(params[:search]).order("artist_commentaries.id desc").paginate(params[:page], :limit => params[:limit]) @commentaries = ArtistCommentary.search(params[:search]).order("artist_commentaries.id desc").paginate(params[:page], :limit => params[:limit])

View File

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

View File

@@ -1,5 +1,7 @@
class DelayedJobsController < ApplicationController class DelayedJobsController < ApplicationController
respond_to :html, :xml, :json
def index def index
@delayed_jobs = Delayed::Job.order("created_at desc").paginate(params[:page], :limit => params[:limit]) @delayed_jobs = Delayed::Job.order("created_at desc").paginate(params[:page], :limit => params[:limit])
respond_with(@delayed_jobs)
end end
end end

View File

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

View File

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

View File

@@ -1,6 +1,5 @@
class NoteVersionsController < ApplicationController class NoteVersionsController < ApplicationController
respond_to :html, :xml, :json respond_to :html, :xml, :json
before_filter :member_only, :except => [:index, :show]
def index def index
@note_versions = NoteVersion.search(params[:search]).order("note_versions.id desc").paginate(params[:page], :limit => params[:limit]) @note_versions = NoteVersion.search(params[:search]).order("note_versions.id desc").paginate(params[:page], :limit => params[:limit])

View File

@@ -1,5 +1,5 @@
class PostAppealsController < ApplicationController class PostAppealsController < ApplicationController
before_filter :member_only before_filter :member_only, :except => [:index, :show]
respond_to :html, :xml, :json, :js respond_to :html, :xml, :json, :js
def new def new

View File

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

View File

@@ -1,5 +1,5 @@
class PostFlagsController < ApplicationController class PostFlagsController < ApplicationController
before_filter :member_only before_filter :member_only, :except => [:index, :show]
respond_to :html, :xml, :json, :js respond_to :html, :xml, :json, :js
def new def new

View File

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

View File

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

View File

@@ -26,6 +26,12 @@ module Danbooru
end end
end end
class Delayed::Job
def hidden_attributes
[:handler]
end
end
class ActiveRecord::Base class ActiveRecord::Base
include Danbooru::Extensions::ActiveRecordApi include Danbooru::Extensions::ActiveRecordApi
end end