From 611beb2e902fa1df82ad4a0ee714dc56c2b5dcf3 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Sun, 30 Jan 2022 09:40:41 +0000 Subject: [PATCH] Rearrange controller placement, field order, and nesting --- app/views/split_checkout/_details.html.haml | 40 +++++++++++---------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/app/views/split_checkout/_details.html.haml b/app/views/split_checkout/_details.html.haml index 83762eda6b..22ae7d5031 100644 --- a/app/views/split_checkout/_details.html.haml +++ b/app/views/split_checkout/_details.html.haml @@ -25,7 +25,7 @@ = bill_address.text_field :phone, { placeholder: t("split_checkout.step1.your_details.phone.placeholder") } = f.error_message_on "bill_address.phone" - %div.checkout-substep{ "data-controller": "dependant-select", "data-dependant-select-options-value": countries_with_states } + %div.checkout-substep -# BILLING ADDRESS %div.checkout-title = t("split_checkout.step1.billing_address.title") @@ -45,20 +45,21 @@ = bill_address.text_field :city, { placeholder: t("split_checkout.step1.address.city.placeholder") } = f.error_message_on "bill_address.city" - - bill_address_country = @order.bill_address.country || DefaultCountry.country - - %div.checkout-input - = bill_address.label :state_id, t("split_checkout.step1.address.state_id.label") - = bill_address.select :state_id, states_for_country(bill_address_country), { selected: @order.bill_address&.state_id }, { "data-dependant-select-target": "select" } - %div.checkout-input = bill_address.label :zipcode, t("split_checkout.step1.address.zipcode.label") = bill_address.text_field :zipcode, { placeholder: t("split_checkout.step1.address.zipcode.placeholder") } = f.error_message_on "bill_address.zipcode" - %div.checkout-input - = bill_address.label :country_id, t("split_checkout.step1.address.country_id.label") - = bill_address.select :country_id, countries, { selected: bill_address_country.id }, { "data-dependant-select-target": "source", "data-action": "dependant-select#handleSelectChange" } + %div{ "data-controller": "dependant-select", "data-dependant-select-options-value": countries_with_states } + - bill_address_country = @order.bill_address.country || DefaultCountry.country + + %div.checkout-input + = bill_address.label :country_id, t("split_checkout.step1.address.country_id.label") + = bill_address.select :country_id, countries, { selected: bill_address_country.id }, { "data-dependant-select-target": "source", "data-action": "dependant-select#handleSelectChange" } + + %div.checkout-input + = bill_address.label :state_id, t("split_checkout.step1.address.state_id.label") + = bill_address.select :state_id, states_for_country(bill_address_country), { selected: @order.bill_address&.state_id }, { "data-dependant-select-target": "select" } - if spree_current_user||true %div.checkout-input @@ -123,20 +124,21 @@ = ship_address.text_field :city, { placeholder: t("split_checkout.step1.address.city.placeholder") } = f.error_message_on "ship_address.city" - - ship_address_country = @order.ship_address.country || DefaultCountry.country - - %div.checkout-input - = ship_address.label :state_id, t("split_checkout.step1.address.state_id.label") - = ship_address.select :state_id, states_for_country(ship_address_country), { selected: @order.ship_address&.state_id }, { "data-dependant-select-target": "select" } - %div.checkout-input = ship_address.label :zipcode, t("split_checkout.step1.address.zipcode.label") = ship_address.text_field :zipcode, { placeholder: t("split_checkout.step1.address.zipcode.placeholder") } = f.error_message_on "ship_address.zipcode" - %div.checkout-input - = ship_address.label :country_id, t("split_checkout.step1.address.country_id.label") - = ship_address.select :country_id, countries, { selected: ship_address_country.id }, { "data-dependant-select-target": "source", "data-action": "dependant-select#handleSelectChange" } + %div + - ship_address_country = @order.ship_address.country || DefaultCountry.country + + %div.checkout-input + = ship_address.label :country_id, t("split_checkout.step1.address.country_id.label") + = ship_address.select :country_id, countries, { selected: ship_address_country.id }, { "data-dependant-select-target": "source", "data-action": "dependant-select#handleSelectChange" } + + %div.checkout-input + = ship_address.label :state_id, t("split_checkout.step1.address.state_id.label") + = ship_address.select :state_id, states_for_country(ship_address_country), { selected: @order.ship_address&.state_id }, { "data-dependant-select-target": "select" } - if spree_current_user %div.checkout-input{ "data-toggle-target": "content", style: "display: none" }