From 214a470896364fbdb8537da4074051982e483893 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Tue, 31 May 2022 15:51:10 +0200 Subject: [PATCH] Remove the report Subtype selector in the Rendering Options section + add all sub-reports in the index page all of this is behind a feature toggle --- app/views/admin/reports/_rendering_options.html.haml | 12 ++++++++---- app/views/admin/reports/_report_subtype.html.haml | 5 +++++ app/views/admin/reports/index.html.haml | 8 +++----- 3 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 app/views/admin/reports/_report_subtype.html.haml diff --git a/app/views/admin/reports/_rendering_options.html.haml b/app/views/admin/reports/_rendering_options.html.haml index 32639d6e35..051e99591b 100644 --- a/app/views/admin/reports/_rendering_options.html.haml +++ b/app/views/admin/reports/_rendering_options.html.haml @@ -1,8 +1,12 @@ - if @report_subtypes.present? && @report_subtypes.count > 1 - .row - .alpha.two.columns= label_tag nil, t(:report_type) - .omega.fourteen.columns - = select_tag(:report_subtype, options_for_select(@report_subtypes, @report_subtype)) + - if feature?(:report_inverse_columns_logic, spree_current_user) + %input{type: 'hidden', name: 'report_subtype', value: @report_subtype} + - else + .row + .alpha.two.columns= label_tag nil, t(:report_type) + .omega.fourteen.columns + = select_tag(:report_subtype, options_for_select(@report_subtypes, @report_subtype)) + - if @report.header_option? || @report.summary_row_option? .row diff --git a/app/views/admin/reports/_report_subtype.html.haml b/app/views/admin/reports/_report_subtype.html.haml new file mode 100644 index 0000000000..3f56ca72a9 --- /dev/null +++ b/app/views/admin/reports/_report_subtype.html.haml @@ -0,0 +1,5 @@ +%ul{style: "margin-left: 12pt"} + - report_subtypes.each do |report_subtype| + %li + - url = main_app.admin_report_url(report_type: report_type, report_subtype: report_subtype[1]) + = link_to report_subtype[0], url diff --git a/app/views/admin/reports/index.html.haml b/app/views/admin/reports/index.html.haml index 4465695cd6..132653a982 100644 --- a/app/views/admin/reports/index.html.haml +++ b/app/views/admin/reports/index.html.haml @@ -17,9 +17,7 @@ %td - begin = I18n.t!(:description, scope: [:admin, :reports, report_type]) + - if feature? :report_inverse_columns_logic, spree_current_user + = render partial: "report_subtype", locals: { report_subtypes: report_subtypes, report_type: report_type } - rescue I18n::MissingTranslationData - %ul{style: "margin-left: 12pt"} - - report_subtypes.each do |report_subtype| - %li - - url = main_app.admin_report_url(report_type: report_type, report_subtype: report_subtype[1]) - = link_to report_subtype[0], url \ No newline at end of file + = render partial: "report_subtype", locals: { report_subtypes: report_subtypes, report_type: report_type }