Get shipping method from Shipment in order details

This again gets the shipping method from the last shipment. It also
extracts partials for delivery and pickup shipping methods.
This commit is contained in:
Pau Perez
2017-07-03 13:05:15 +02:00
parent 06345e9161
commit 6f7c8bb8b1
4 changed files with 59 additions and 53 deletions

View File

@@ -0,0 +1,25 @@
.order-summary.text-small
%strong= shipment.shipping_method.name
.pad
.text-big
= t :order_delivery_time
%strong #{order.order_cycle.pickup_time_for(order.distributor)}
%p.text-small.text-skinny.pre-line
%em= shipment.shipping_method.description.andand.html_safe || ""
.order-summary.text-small
%strong
= t :order_delivery_address
.pad
%p.text-small
= order.ship_address.firstname + " " + order.ship_address.lastname
%br
= order.ship_address.full_address
%br
= order.ship_address.phone
- if order.special_instructions.present?
%br
%p.light.small
%strong
= t :order_special_instructions
%br
= order.special_instructions

View File

@@ -29,60 +29,11 @@
= order.bill_address.phone
.columns.large-6
- if order.shipping_method.andand.require_ship_address
// Delivery option
.order-summary.text-small
%strong= order.shipping_method.name
.pad
.text-big
= t :order_delivery_time
%strong #{order.order_cycle.pickup_time_for(order.distributor)}
%p.text-small.text-skinny.pre-line
%em= order.shipping_method.description.andand.html_safe || ""
.order-summary.text-small
%strong
= t :order_delivery_address
.pad
%p.text-small
= order.ship_address.firstname + " " + order.ship_address.lastname
%br
= order.ship_address.full_address
%br
= order.ship_address.phone
- if order.special_instructions.present?
%br
%p.light.small
%strong
= t :order_special_instructions
%br
= order.special_instructions
- shipment = order.shipments.last
- if shipment.shipping_method.andand.require_ship_address
= render 'spree/shared/delivery_shipment_details', order: order, shipment: shipment
- else
// Collection option
.order-summary.text-small
%strong= order.shipping_method.name
.pad
.text-big
= t :order_pickup_time
%strong #{order.order_cycle.pickup_time_for(order.distributor)}
%p.text-small.text-skinny.pre-line
%em= order.shipping_method.description.andand.html_safe || ""
- if order.order_cycle.pickup_instructions_for(order.distributor).present?
%br
%p.text-small
%strong
= t :order_pickup_instructions
%br
#{order.order_cycle.pickup_instructions_for(order.distributor)}
- if order.special_instructions.present?
%br
%p.light.small
%strong
= t :order_special_instructions
%br
= order.special_instructions
= render 'spree/shared/pickup_shipment_details', order: order, shipment: shipment
%br
.row
.columns.large-12

View File

@@ -0,0 +1,25 @@
.order-summary.text-small
%strong= order.shipments.last.shipping_method.name
.pad
.text-big
= t :order_pickup_time
%strong #{order.order_cycle.pickup_time_for(order.distributor)}
%p.text-small.text-skinny.pre-line
%em= order.shipments.last.shipping_method.description.andand.html_safe || ""
- if order.order_cycle.pickup_instructions_for(order.distributor).present?
%br
%p.text-small
%strong
= t :order_pickup_instructions
%br
#{order.order_cycle.pickup_instructions_for(order.distributor)}
- if order.special_instructions.present?
%br
%p.light.small
%strong
= t :order_special_instructions
%br
= order.special_instructions

View File

@@ -21,6 +21,11 @@ feature "Order Management", js: true do
quick_login_as user
end
it 'shows the name of the shipping method' do
visit spree.order_path(order)
expect(find('#order')).to have_content(shipping_method.name)
end
context "when the distributor doesn't allow changes to be made to orders" do
before do
order.distributor.update_attributes(allow_order_changes: false)