Also include '»' links next to uploader/approver names for drilling down the search by a given user.
35 lines
973 B
Ruby
35 lines
973 B
Ruby
class PostAppealsController < ApplicationController
|
|
before_filter :member_only, :except => [:index, :show]
|
|
respond_to :html, :xml, :json, :js
|
|
|
|
def new
|
|
@post_appeal = PostAppeal.new
|
|
respond_with(@post_appeal)
|
|
end
|
|
|
|
def index
|
|
@post_appeals = PostAppeal.includes(:creator).search(params[:search]).includes(post: [:appeals, :uploader, :approver])
|
|
@post_appeals = @post_appeals.paginate(params[:page], limit: params[:limit])
|
|
respond_with(@post_appeals) do |format|
|
|
format.xml do
|
|
render :xml => @post_appeals.to_xml(:root => "post-appeals")
|
|
end
|
|
end
|
|
end
|
|
|
|
def create
|
|
@post_appeal = PostAppeal.create(params[:post_appeal])
|
|
respond_with(@post_appeal)
|
|
end
|
|
|
|
def show
|
|
@post_appeal = PostAppeal.find(params[:id])
|
|
respond_with(@post_appeal)
|
|
end
|
|
|
|
private
|
|
def check_privilege(post_appeal)
|
|
raise User::PrivilegeError unless (post_appeal.creator_id == CurrentUser.id || CurrentUser.is_moderator?)
|
|
end
|
|
end
|