diff --git a/app/helpers/checkout_helper.rb b/app/helpers/checkout_helper.rb index 02bc03e152..3aefb48f4b 100644 --- a/app/helpers/checkout_helper.rb +++ b/app/helpers/checkout_helper.rb @@ -122,4 +122,8 @@ module CheckoutHelper "{{ #{price} | localizeCurrency }}" end end + + def checkout_step?(step) + params[:step] == step.to_s + end end diff --git a/app/views/split_checkout/_tabs.html.haml b/app/views/split_checkout/_tabs.html.haml index 9f08b7522d..b285563784 100644 --- a/app/views/split_checkout/_tabs.html.haml +++ b/app/views/split_checkout/_tabs.html.haml @@ -1,12 +1,12 @@ %div.flex - %div.columns.three.text-center.checkout-tab{"class": [("selected" if @checkout_step == "details"), ("success" unless @checkout_step == "details")]} + %div.columns.three.text-center.checkout-tab{"class": [("selected" if checkout_step?(:details)), ("success" unless checkout_step?(:details))]} %span - = link_to_if (@checkout_step != "details"), t("split_checkout.your_details"), main_app.checkout_step_path(:details), {} do + = link_to_unless checkout_step?(:details), t("split_checkout.your_details"), main_app.checkout_step_path(:details) do = t("split_checkout.your_details") - %div.columns.three.text-center.checkout-tab{"class": [("selected" if @checkout_step == "payment"), ("success" if @checkout_step == "summary")]} + %div.columns.three.text-center.checkout-tab{"class": [("selected" if checkout_step?(:payment)), ("success" if checkout_step?(:summary))]} %span - = link_to_if (@checkout_step != "payment"), t("split_checkout.payment_method"), main_app.checkout_step_path(:payment), {} do + = link_to_if checkout_step?(:summary), t("split_checkout.payment_method"), main_app.checkout_step_path(:payment) do = t("split_checkout.payment_method") - %div.columns.three.text-center.checkout-tab{"class": ("selected" if @checkout_step == "summary")} + %div.columns.three.text-center.checkout-tab{"class": ("selected" if checkout_step?(:summary))} %span - = t("split_checkout.order_summary") + = t("split_checkout.order_summary")