* Removed unapprovals, added post flags and post appeals (still need to update tests)
* Restyled text
This commit is contained in:
@@ -10,6 +10,10 @@ class CommentsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def search
|
||||
@search = Comment.search(params[:search])
|
||||
end
|
||||
|
||||
def update
|
||||
@comment = Comment.find(params[:id])
|
||||
@comment.update_attributes(params[:comment])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class DtextController < ApplicationController
|
||||
def preview
|
||||
render :inline => "<h1 class=\"preview-header\">Preview</h1><%= format_text(params[:body]) %>"
|
||||
render :inline => "<h3 class=\"preview-header\">Preview</h3><%= format_text(params[:body]) %>"
|
||||
end
|
||||
end
|
||||
|
||||
25
app/controllers/post_appeals_controller.rb
Normal file
25
app/controllers/post_appeals_controller.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
class PostAppealsController < ApplicationController
|
||||
before_filter :member_only
|
||||
respond_to :html, :xml, :json, :js
|
||||
rescue_from User::PrivilegeError, :with => "static/access_denied"
|
||||
|
||||
def new
|
||||
@post_appeal = PostAppeal.new
|
||||
respond_with(@post_appeal)
|
||||
end
|
||||
|
||||
def index
|
||||
@search = PostAppeal.search(params[:search])
|
||||
@post_appeals = @search.paginate(:page => params[:page])
|
||||
end
|
||||
|
||||
def create
|
||||
@post_appeal = PostAppeal.create(params[:post_appeal])
|
||||
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
|
||||
25
app/controllers/post_flags_controller.rb
Normal file
25
app/controllers/post_flags_controller.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
class PostFlagsController < ApplicationController
|
||||
before_filter :member_only
|
||||
respond_to :html, :xml, :json, :js
|
||||
rescue_from User::PrivilegeError, :with => "static/access_denied"
|
||||
|
||||
def new
|
||||
@post_flag = PostFlag.new
|
||||
respond_with(@post_flag)
|
||||
end
|
||||
|
||||
def index
|
||||
@search = PostFlag.search(params[:search])
|
||||
@post_flags = @search.paginate(:page => params[:page])
|
||||
end
|
||||
|
||||
def create
|
||||
@post_flag = PostFlag.create(params[:post_flag])
|
||||
respond_with(@post_flag)
|
||||
end
|
||||
|
||||
private
|
||||
def check_privilege(post_flag)
|
||||
raise User::PrivilegeError unless (post_flag.creator_id == CurrentUser.id || CurrentUser.is_moderator?)
|
||||
end
|
||||
end
|
||||
@@ -10,7 +10,8 @@ class PostsController < ApplicationController
|
||||
|
||||
def show
|
||||
@post = Post.find(params[:id])
|
||||
@unapproval = Unapproval.new(:post_id => @post)
|
||||
@post_flag = PostFlag.new(:post_id => @post)
|
||||
@post_appeal = PostAppeal.new(:post_id => @post)
|
||||
respond_with(@post)
|
||||
end
|
||||
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
class UnapprovalsController < ApplicationController
|
||||
before_filter :member_only
|
||||
respond_to :html, :xml, :json, :js
|
||||
rescue_from User::PrivilegeError, :with => "static/access_denied"
|
||||
|
||||
def new
|
||||
@unapproval = Unapproval.new
|
||||
respond_with(@unapproval)
|
||||
end
|
||||
|
||||
def index
|
||||
@search = Unapproval.search(params[:search])
|
||||
@unapprovals = @search.paginate(:page => params[:page])
|
||||
end
|
||||
|
||||
def create
|
||||
@unapproval = Unapproval.create(params[:unapproval])
|
||||
respond_with(@unapproval)
|
||||
end
|
||||
|
||||
def destroy
|
||||
@unapproval = Unapproval.find(params[:id])
|
||||
check_privilege(@unapproval)
|
||||
@unapproval.destroy
|
||||
respond_with(@unapproval)
|
||||
end
|
||||
|
||||
private
|
||||
def check_privilege(unapproval)
|
||||
raise User::PrivilegeError unless (unapproval.unapprover_id == CurrentUser.id || CurrentUser.is_moderator?)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user