1 class ReportsController < ApplicationController
4 before_action :authorize_web
5 before_action :require_user
8 if create_new_report_params.present?
10 @report.issue = Issue.find_or_initialize_by(create_new_report_params)
11 path = "issues.report_strings." + @report.issue.reportable.class.name.to_s
12 @report_strings_yaml = t(path)
17 @report = current_user.reports.new(report_params)
18 @report.issue = Issue.find_or_initialize_by(:reportable_id => params[:report][:issue][:reportable_id], :reportable_type => params[:report][:issue][:reportable_type])
22 # FIXME: reopen issue if necessary
23 # FIXME: new issue notification (or via model observer)
24 redirect_to root_path, :notice => t("issues.create.successful_report")
26 redirect_to new_report_path(:reportable_type => @report.issue.reportable_type, :reportable_id => @report.issue.reportable_id), :notice => t("issues.create.provide_details")
32 def create_new_report_params
33 params.permit(:reportable_id, :reportable_type)
37 params[:report].permit(:details)