mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-27 06:05:19 +00:00
Change UX to transform from fields_to_hide to fields_to_show
Fill `params[:fields_to_show]` with its default value
This commit is contained in:
@@ -46,6 +46,7 @@ module Admin
|
|||||||
|
|
||||||
# Initialize data
|
# Initialize data
|
||||||
params[:display_summary_row] = true if request.get?
|
params[:display_summary_row] = true if request.get?
|
||||||
|
params[:fields_to_show] = @report.columns.keys if request.get?
|
||||||
|
|
||||||
@data = Reporting::FrontendData.new(spree_current_user)
|
@data = Reporting::FrontendData.new(spree_current_user)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -19,9 +19,9 @@
|
|||||||
|
|
||||||
- if @report.available_headers.present?
|
- if @report.available_headers.present?
|
||||||
.row
|
.row
|
||||||
.alpha.two.columns= label_tag nil, t(:report_hide_columns)
|
.alpha.two.columns= label_tag nil, t(:report_columns)
|
||||||
.omega.fourteen.columns
|
.omega.fourteen.columns
|
||||||
= select_tag(:fields_to_hide, options_for_select(@report.available_headers, params[:fields_to_hide]),
|
= select_tag(:fields_to_show, options_for_select(@report.available_headers, params[:fields_to_show]),
|
||||||
class: "select2 fullwidth", multiple: true)
|
class: "select2 fullwidth", multiple: true)
|
||||||
|
|
||||||
.row.rendering-options
|
.row.rendering-options
|
||||||
|
|||||||
@@ -2625,7 +2625,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
|
|||||||
report_payment_totals: 'Payment Totals'
|
report_payment_totals: 'Payment Totals'
|
||||||
report_all: 'all'
|
report_all: 'all'
|
||||||
report_order_cycle: "Order Cycle"
|
report_order_cycle: "Order Cycle"
|
||||||
report_hide_columns: Columns to Hide
|
report_columns: Columns
|
||||||
report_enterprises: "Enterprises"
|
report_enterprises: "Enterprises"
|
||||||
report_enterprise_fee: "Fees Names"
|
report_enterprise_fee: "Fees Names"
|
||||||
report_users: "Users"
|
report_users: "Users"
|
||||||
|
|||||||
@@ -250,6 +250,7 @@ describe Admin::ReportsController, type: :controller do
|
|||||||
.and_return(report = double(:report))
|
.and_return(report = double(:report))
|
||||||
allow(report).to receive(:table_headers).and_return []
|
allow(report).to receive(:table_headers).and_return []
|
||||||
allow(report).to receive(:table_rows).and_return []
|
allow(report).to receive(:table_rows).and_return []
|
||||||
|
allow(report).to receive(:columns).and_return({})
|
||||||
spree_get :show, report_type: :products_and_inventory, test: "foo"
|
spree_get :show, report_type: :products_and_inventory, test: "foo"
|
||||||
expect(assigns(:report)).to eq(report)
|
expect(assigns(:report)).to eq(report)
|
||||||
end
|
end
|
||||||
@@ -300,6 +301,7 @@ describe Admin::ReportsController, type: :controller do
|
|||||||
.and_return(report = double(:report))
|
.and_return(report = double(:report))
|
||||||
allow(report).to receive(:table_headers).and_return []
|
allow(report).to receive(:table_headers).and_return []
|
||||||
allow(report).to receive(:table_rows).and_return []
|
allow(report).to receive(:table_rows).and_return []
|
||||||
|
allow(report).to receive(:columns).and_return({})
|
||||||
spree_get :show, report_type: :customers, test: "foo"
|
spree_get :show, report_type: :customers, test: "foo"
|
||||||
expect(assigns(:report)).to eq(report)
|
expect(assigns(:report)).to eq(report)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user