aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/reports_controller.rb
diff options
context:
space:
mode:
authorMatthew Landauer <matthew@openaustralia.org>2013-03-22 16:48:48 +1100
committerMatthew Landauer <matthew@openaustralia.org>2013-03-22 16:48:48 +1100
commit5fbb8f4357fd759cadfa0191694d3bad49d86a90 (patch)
tree6098abe7df7225314a554fe254c8091813403f91 /app/controllers/reports_controller.rb
parent6c2f4ff8bc6d8e91e7d6ea5ee85fb793aa06d74a (diff)
Move reporting actions to their own controller
Diffstat (limited to 'app/controllers/reports_controller.rb')
-rw-r--r--app/controllers/reports_controller.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/app/controllers/reports_controller.rb b/app/controllers/reports_controller.rb
new file mode 100644
index 000000000..cf1ad19e7
--- /dev/null
+++ b/app/controllers/reports_controller.rb
@@ -0,0 +1,23 @@
+class ReportsController < ApplicationController
+ def report_request
+ info_request = InfoRequest.find_by_url_title!(params[:url_title])
+ if !authenticated_user
+ flash[:notice] = _("You need to be logged in to report a request for administrator attention")
+ elsif info_request.attention_requested
+ flash[:notice] = _("This request has already been reported for administrator attention")
+ else
+ info_request.report!(params[:reason], params[:message], @user)
+ flash[:notice] = _("This request has been reported for administrator attention")
+ end
+ redirect_to request_url(info_request)
+ end
+
+ def new_report_request
+ @info_request = InfoRequest.find_by_url_title!(params[:url_title])
+ if authenticated?(
+ :web => _("To report this request"),
+ :email => _("Then you can report the request '{{title}}'", :title => @info_request.title),
+ :email_subject => _("Report an offensive or unsuitable request"))
+ end
+ end
+end