Class: Forge::CommentsController
Instance Method Summary
collapse
#get_menu_items, #load_help, #set_crumbs, #set_title, #uses_ckeditor
#app_init
Instance Method Details
#approve ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/forge/app/controllers/forge/comments_controller.rb', line 16
def approve
respond_to do |format|
if .approve!
format.js { render :nothing => true }
format.html { flash[:notice] = "Comment approved." and redirect_to }
else
format.js { render :status => 500 }
format.html { flash[:warning] = "Error approving comment." and redirect_to }
end
end
end
|
#destroy ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/forge/app/controllers/forge/comments_controller.rb', line 40
def destroy
respond_to do |format|
if .destroy
format.js { render :nothing => true }
format.html { flash[:notice] = "Comment deleted." and redirect_to }
else
format.js { render :status => 500 }
format.html { flash[:warning] = "Error deleting comment." and redirect_to }
end
end
end
|
#index ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/forge/app/controllers/forge/comments_controller.rb', line 4
def index
conditions = ["approved = ?", false] if params[:show] == "unapproved"
conditions = ["approved = ?", true] if params[:show] == "approved"
respond_to do |format|
format.html { = .where(conditions).paginate(:include => :commentable, :per_page => 10, :page => params[:page]) }
format.js {
= .where("author LIKE ? OR content LIKE ?", "%#{params[:q]}%", "%#{params[:q]}%")
render :partial => "comment", :collection =>
}
end
end
|
#unapprove ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/forge/app/controllers/forge/comments_controller.rb', line 28
def unapprove
respond_to do |format|
if .unapprove!
format.js { render :nothing => true }
format.html { flash[:notice] = "Comment unapproved." and redirect_to }
else
format.js { render :status => 500 }
format.html { flash[:warning] = "Error unapproving comment." and redirect_to }
end
end
end
|