Files
danbooru/app/controllers/janitor_trials_controller.rb
2013-05-15 01:01:19 -04:00

46 lines
1.1 KiB
Ruby

class JanitorTrialsController < ApplicationController
respond_to :html, :xml, :json
before_filter :moderator_only, :only => [:create, :promote, :demote]
def new
@janitor_trial = JanitorTrial.new
respond_with(@janitor_trial)
end
def edit
@janitor_trial = JanitorTrial.find(params[:id])
respond_with(@janitor_trial)
end
def index
@search = JanitorTrial.search(params[:search])
@janitor_trials = @search.order("id desc").paginate(params[:page], :limit => params[:limit])
respond_with(@janitor_trials)
end
def create
@janitor_trial = JanitorTrial.create(params[:janitor_trial])
respond_with(@janitor_trial, :location => janitor_trials_path)
end
def promote
@janitor_trial = JanitorTrial.find(params[:id])
@janitor_trial.promote!
respond_with(@janitor_trial) do |format|
format.js
end
end
def demote
@janitor_trial = JanitorTrial.find(params[:id])
@janitor_trial.demote!
respond_with(@janitor_trial) do |format|
format.js
end
end
def test
@tester = JanitorTrialTester.new(params[:janitor_trial][:user_name])
end
end