aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/reports_controller.rb
blob: 070a91421d28494b46a1a7a57501a549a278f6fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class ReportsController < ApplicationController
    def create
        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
        @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