Introduce FeatureToggle for columns logic

relative to a46416a98
This commit is contained in:
Jean-Baptiste Bellet
2022-05-31 14:57:36 +02:00
parent c102eecb18
commit 78c2f76a3f
3 changed files with 15 additions and 5 deletions

View File

@@ -46,7 +46,10 @@ module Admin
# Initialize data
params[:display_summary_row] = true if request.get?
params[:fields_to_show] = @report.columns.keys if request.get?
if OpenFoodNetwork::FeatureToggle.enabled?(:report_inverse_columns_logic,
spree_current_user) && request.get?
params[:fields_to_show] = @report.columns.keys
end
@data = Reporting::FrontendData.new(spree_current_user)
end

View File

@@ -19,10 +19,16 @@
- if @report.available_headers.present?
.row
.alpha.two.columns= label_tag nil, t(:report_columns)
.omega.fourteen.columns
= select_tag(:fields_to_show, options_for_select(@report.available_headers, params[:fields_to_show]),
class: "select2 fullwidth", multiple: true)
- if feature? :report_inverse_columns_logic, spree_current_user
.alpha.two.columns= label_tag nil, t(:report_columns)
.omega.fourteen.columns
= select_tag(:fields_to_show, options_for_select(@report.available_headers, params[:fields_to_show]),
class: "select2 fullwidth", multiple: true)
- else
.alpha.two.columns= label_tag nil, t(:report_hide_columns)
.omega.fourteen.columns
= select_tag(:fields_to_hide, options_for_select(@report.available_headers, params[:fields_to_hide]),
class: "select2 fullwidth", multiple: true)
.row.rendering-options
.alpha.two.columns

View File

@@ -2625,6 +2625,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
report_payment_totals: 'Payment Totals'
report_all: 'all'
report_order_cycle: "Order Cycle"
report_hide_columns: Columns to Hide
report_columns: Columns
report_enterprises: "Enterprises"
report_enterprise_fee: "Fees Names"