Adding 'Cancel Order' button to order confimation interface

This commit is contained in:
Rob Harrington
2017-04-06 12:38:34 +10:00
parent c6afa1849c
commit 5d9f92eaa7
5 changed files with 27 additions and 11 deletions

View File

@@ -290,7 +290,7 @@ Spree::Order.class_eval do
end
def editable?
distributor.andand.allow_order_changes? && order_cycle.andand.open?
complete? && distributor.andand.allow_order_changes? && order_cycle.andand.open?
end
private

View File

@@ -4,11 +4,11 @@
%i.ofn-i_008-caret-left
= t(:back_to_store)
- if order.editable?
.columns.show-for-medium-up.medium-6  
-# .columns.small-12.medium-3  
-# = link_to "#", method: :delete, :class => "button secondary expand" do
-# %i.ofn-i_009-close
-# =t(:cancel_order)
.columns.show-for-medium-up.medium-3  
.columns.small-12.medium-3
= link_to spree.cancel_order_path(@order), method: :put, :class => "button secondary expand" do
%i.ofn-i_009-close
= t(:cancel_order)
.columns.small-12.medium-3
= button_tag :class => 'button primary radius expand', :id => 'update-button' do
%i.ofn-i_051-check-big

View File

@@ -10,8 +10,15 @@
.row
.columns.large-12.text-center
%h2
= t :orders_show_number
= " #" + @order.number
= t(:orders_show_order_number, number: @order.number)
- if @order.canceled?
%span.brick
= t(:orders_show_cancelled)
%i.ofn-i_009-close
- elsif @order.complete?
%span.turquoise
= t(:orders_show_confirmed)
%i.ofn-i_051-check-big
#order{"data-hook" => ""}
- if params.has_key? :checkout_complete