Skip to content

Commit

Permalink
FIx another bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian-Hirt committed Sep 6, 2023
1 parent 7ebd013 commit 773bb0f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/controllers/shop/checkout_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ def accept_gtcs
respond_to :turbo_stream
end

def refuse_gtcs
respond_to :turbo_stream
end

def set_address
run Operations::Shop::Order::SetOrderAddress

Expand Down
6 changes: 5 additions & 1 deletion app/views/shop/checkout/_terms_and_conditions_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@
= link_to _('Order|the terms and conditions page'), AppConfig.terms_and_conditions_url, target: :_blank, rel: :noopener
.card-footer
= f.save _('Order|Accept terms and conditions'), class: %i[btn-default]
= button _('Order|Do not accept terms and conditions'), root_path, color: :secondary, confirm: _('Order|You need to accept the terms and conditions to continue your checkyout. Are you sure you do not want to accept the terms and conditions?')
= button _('Order|Do not accept terms and conditions'),
shop_checkout_refuse_gtcs_path(id: op.order.id),
color: :secondary,
method: :patch,
confirm: _('Order|You need to accept the terms and conditions to continue your checkyout. Are you sure you do not want to accept the terms and conditions?')
2 changes: 2 additions & 0 deletions app/views/shop/checkout/refuse_gtcs.turbo_stream.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
= turbo_stream.replace 'terms_and_conditions' do
%div{ data: { controller: 'redirect', url: shop_url } }
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
get :checkout, to: 'checkout#show'
patch :'checkout/set_address', to: 'checkout#set_address'
patch :'checkout/accept_gtcs', to: 'checkout#accept_gtcs'
patch :'checkout/refuse_gtcs', to: 'checkout#refuse_gtcs'
post :'checkout/use_promotion_code', to: 'checkout#use_promotion_code'

resources :orders, only: %i[index show] do
Expand Down

0 comments on commit 773bb0f

Please sign in to comment.