diff --git a/app/controllers/admin/reports_controller.rb b/app/controllers/admin/reports_controller.rb index 176b5c02cb..4258b0fb58 100644 --- a/app/controllers/admin/reports_controller.rb +++ b/app/controllers/admin/reports_controller.rb @@ -43,11 +43,7 @@ module Admin @report_type = report_type @report_subtypes = report_subtypes @report_subtype = report_subtype - @report_title = if report_subtype - report_subtype_title - else - I18n.t(:name, scope: [:admin, :reports, @report_type]) - end + @report_title = report_title @rendering_options = rendering_options @table = @report.to_html if request.post? @data = Reporting::FrontendData.new(spree_current_user) diff --git a/app/controllers/concerns/reports_actions.rb b/app/controllers/concerns/reports_actions.rb index 4f6a8994c4..7fa6615733 100644 --- a/app/controllers/concerns/reports_actions.rb +++ b/app/controllers/concerns/reports_actions.rb @@ -39,6 +39,14 @@ module ReportsActions params[:report_subtype] || report_subtypes_codes.first end + def report_title + if report_subtype + report_subtype_title + else + I18n.t(:name, scope: [:admin, :reports, report_type]) + end + end + def report_subtype_title report_subtypes.select { |_name, key| key.to_sym == report_subtype.to_sym }.first[0] end