5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/forge/app/controllers/comments_controller.rb', line 5
def create
params[:comment].merge!({:user_ip => request.remote_ip, :user_agent => request.env['HTTP_USER_AGENT'], :referrer => request.env['HTTP_REFERER']})
= .new(params[:comment])
if .save
flash[:notice] = "Your comment was submitted successfully."
flash[:notice] += " It is awaiting moderation and will be posted soon." if !.approved
flash[:notice] += " <a href='#comment-#{@comment.id}'>Jump to it now.</a>" if .approved
session[:comment] = ""
session[:comment_errors] = ""
redirect_to .referrer and return false
else
flash[:warning] = "There was a problem adding your comment. Check the comment form for more details."
session[:comment] = params[:comment]
session[:comment_errors] = .error_message
redirect_to .referrer
end
end
|