mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-24 05:38:52 +00:00
Tidy up use of @checkout_step
This commit is contained in:
@@ -15,7 +15,6 @@ class SplitCheckoutController < ::BaseController
|
||||
# Otherwise we fail on duplicate indexes or end up with negative stock.
|
||||
prepend_around_action CurrentOrderLocker, only: [:edit, :update]
|
||||
|
||||
prepend_before_action :set_checkout_step
|
||||
prepend_before_action :check_hub_ready_for_checkout
|
||||
prepend_before_action :check_order_cycle_expiry
|
||||
prepend_before_action :require_order_cycle
|
||||
@@ -37,7 +36,7 @@ class SplitCheckoutController < ::BaseController
|
||||
def edit
|
||||
return handle_redirect_from_stripe if valid_payment_intent_provided?
|
||||
|
||||
redirect_to_step unless @checkout_step
|
||||
redirect_to_step unless checkout_step
|
||||
|
||||
# This is only required because of spree_paypal_express. If we implement
|
||||
# a version of paypal that uses this controller, and more specifically
|
||||
@@ -68,8 +67,8 @@ class SplitCheckoutController < ::BaseController
|
||||
|
||||
private
|
||||
|
||||
def set_checkout_step
|
||||
@checkout_step = params[:step]
|
||||
def checkout_step
|
||||
@checkout_step ||= params[:step]
|
||||
end
|
||||
|
||||
def order_params
|
||||
|
||||
@@ -123,7 +123,11 @@ module CheckoutHelper
|
||||
end
|
||||
end
|
||||
|
||||
def checkout_step
|
||||
params[:step]
|
||||
end
|
||||
|
||||
def checkout_step?(step)
|
||||
params[:step] == step.to_s
|
||||
checkout_step == step.to_s
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
= inject_saved_credit_cards
|
||||
|
||||
%div.checkout-step.medium-6
|
||||
= form_with url: checkout_update_path(@checkout_step), model: @order, method: :put do |f|
|
||||
= render "split_checkout/#{@checkout_step}", f: f
|
||||
= form_with url: checkout_update_path(checkout_step), model: @order, method: :put do |f|
|
||||
= render "split_checkout/#{checkout_step}", f: f
|
||||
|
||||
Reference in New Issue
Block a user