mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-23 05:28:53 +00:00
In admin, add form to set hide_groups_tab attribute
+ add specs
This commit is contained in:
@@ -35,7 +35,8 @@ module PermittedAttributes
|
||||
:show_customer_names_to_suppliers, :preferred_shopfront_product_sorting_method,
|
||||
:preferred_invoice_order_by_supplier,
|
||||
:preferred_product_low_stock_display,
|
||||
:hide_ofn_navigation, :white_label_logo, :white_label_logo_link
|
||||
:hide_ofn_navigation, :white_label_logo, :white_label_logo_link,
|
||||
:hide_groups_tab
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -29,3 +29,11 @@
|
||||
= render ConfirmModalComponent.new(id: "remove_logo", confirm_reflexes: "click->WhiteLabel#remove_logo" ) do
|
||||
.margin-bottom-30
|
||||
= t('.remove_logo_confirm')
|
||||
|
||||
// Hide groups tab boolean attribute
|
||||
|
||||
.row
|
||||
.three.columns.alpha
|
||||
= f.label :hide_groups_tab, t('.hide_groups_tab')
|
||||
.three.columns
|
||||
= f.check_box :hide_groups_tab
|
||||
|
||||
@@ -1185,6 +1185,7 @@ en:
|
||||
remove_logo_confirm: "Are you sure you want to remove this logo?"
|
||||
remove_logo_success: "Logo removed"
|
||||
white_label_logo_link_label: "Link for the logo used in shopfront"
|
||||
hide_groups_tab: "Hide groups tab in shopfront"
|
||||
actions:
|
||||
edit_profile: Settings
|
||||
properties: Properties
|
||||
|
||||
@@ -706,6 +706,25 @@ describe '
|
||||
expect(distributor1.reload.white_label_logo_link).to eq("https://www.openfoodnetwork.org")
|
||||
end
|
||||
end
|
||||
|
||||
it "can check/uncheck the hide_groups_tab attribute" do
|
||||
check "Hide groups tab in shopfront"
|
||||
click_button 'Update'
|
||||
expect(flash_message)
|
||||
.to eq('Enterprise "First Distributor" has been successfully updated!')
|
||||
expect(distributor1.reload.hide_groups_tab).to be true
|
||||
|
||||
visit edit_admin_enterprise_path(distributor1)
|
||||
within(".side_menu") do
|
||||
click_link "White Label"
|
||||
end
|
||||
|
||||
uncheck "Hide groups tab in shopfront"
|
||||
click_button 'Update'
|
||||
expect(flash_message)
|
||||
.to eq('Enterprise "First Distributor" has been successfully updated!')
|
||||
expect(distributor1.reload.hide_groups_tab).to be false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user