Split method for easier reading

This commit is contained in:
Maikel Linke
2023-01-09 11:38:19 +11:00
committed by Filipe
parent 65843fbd68
commit 0c769706aa
2 changed files with 9 additions and 5 deletions

View File

@@ -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)

View File

@@ -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