Skip to content

Commit fdf9c61

Browse files
committed
Add Contact information section on stock locations form
1 parent 2a7ed3e commit fdf9c61

4 files changed

Lines changed: 9 additions & 1 deletion

File tree

admin/app/components/solidus_admin/stock_locations/form/component.html.erb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
<% end %>
1313

1414
<%= render component('ui/panel').new(title: t('.address')) do %>
15-
<%= render component('ui/forms/address').new(addressable: @stock_location, form_field_name: 'stock_location', fieldset: :location, excludes: :email) %>
15+
<%= render component('ui/forms/address').new(addressable: @stock_location, form_field_name: 'stock_location', fieldset: :location, excludes: %i[phone email]) %>
16+
<% end %>
17+
18+
<%= render component('ui/panel').new(title: t('.contact_info')) do %>
19+
<%= render component('ui/forms/address').new(addressable: @stock_location, form_field_name: 'stock_location', fieldset: :contact_info) %>
1620
<% end %>
1721
<% end %>
1822

admin/app/components/solidus_admin/stock_locations/form/component.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ en:
44
availability: "Availability"
55
backorderable_default: "Backorderable default"
66
check_stock_on_transfer: "Check stock on transfer"
7+
contact_info: "Contact information"
78
default: "Set as default for all products"
89
fulfillable: "Fulfillable"
910
hints:

admin/app/controllers/solidus_admin/stock_locations_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def permitted_resource_params
1818
:state_name,
1919
:state_id,
2020
:phone,
21+
:email,
2122
:active,
2223
:default,
2324
:backorderable_default,

admin/spec/features/stock_locations/form_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
solidus_select "Canada", from: "Country"
6666
solidus_select "Fictitious State in CA", from: "State"
6767
fill_in "Phone", with: "123123123"
68+
fill_in "Email", with: "example@example.com"
6869
check "Set as default for all products"
6970
check "Backorderable default"
7071

@@ -86,6 +87,7 @@
8687
expect(solidus_select_control("Country")).to have_content("Canada")
8788
expect(solidus_select_control("State")).to have_content("Fictitious State in CA")
8889
expect(find_field("Phone").value).to eq "123123123"
90+
expect(find_field("Email").value).to eq "example@example.com"
8991
expect(checkbox("Active")).to be_checked
9092
expect(checkbox("Propagate all variants")).to be_checked
9193
expect(checkbox("Restock inventory")).to be_checked

0 commit comments

Comments
 (0)