Use the report type or subtype as the title

This commit is contained in:
Jean-Baptiste Bellet
2022-10-20 15:29:50 +02:00
parent 6dec80aaaf
commit e2441cdcf6
3 changed files with 12 additions and 0 deletions

View File

@@ -43,6 +43,11 @@ 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
# Initialize data
params[:display_summary_row] = true if request.get?

View File

@@ -39,6 +39,10 @@ module ReportsActions
params[:report_subtype] || report_subtypes_codes.first
end
def report_subtype_title
report_subtypes.select { |_name, key| key.to_sym == report_subtype.to_sym }.first[0]
end
def ransack_params
raw_params[:q]
end

View File

@@ -1,3 +1,6 @@
- content_for :page_title do
= @report_title
= form_for @report.search, :url => url_for(only_path: false) do |f|
%fieldset.no-border-bottom.print-hidden
%legend{ align: 'center'}= t(:report_filters)