spree_delivery_options 2.1.10 → 2.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/spree/admin/orders/delivery_options_controller.rb +4 -1
- data/app/views/spree/admin/orders/delivery_options/edit.haml +2 -2
- data/spec/controllers/spree/admin/orders/delivery_options_controller_spec.rb +6 -0
- data/spree_delivery_options.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef69bf63aeb1d23e1d531f2da3b22182ab58385f
|
4
|
+
data.tar.gz: 1af6ca42e5e13278d330fe7aadedc25b94b466ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f74882be44280ef5b7b28fb02fbf4ff6c86507e93f6e5c074a8833b6682ba589f33efc13a038cb7460c88e10d8516813b0c04ec52751daff4a0c4d5f3a4a6778
|
7
|
+
data.tar.gz: fd6f475d496428047998db662d443f004c3a0a1fe93a8c355fc12a732572c48d8aa95185fed9495df394c389ed9c616b320b73d320a5871c0afa8c7602843781
|
@@ -9,7 +9,10 @@ module Spree
|
|
9
9
|
|
10
10
|
def update
|
11
11
|
@order = Order.find_by(number: params[:order_id])
|
12
|
-
@order.update_attributes(delivery_options_params)
|
12
|
+
if @order.update_attributes(delivery_options_params) && @order.next
|
13
|
+
flash[:success] = Spree.t('delivery_options_updated')
|
14
|
+
end
|
15
|
+
|
13
16
|
render :edit
|
14
17
|
end
|
15
18
|
|
@@ -23,10 +23,10 @@
|
|
23
23
|
= f.label :delivery_date, "Delivery Date"
|
24
24
|
= f.text_field :delivery_date, class: "datepicker"
|
25
25
|
.field
|
26
|
-
-
|
26
|
+
- delivery_options = JSON.parse(SpreeDeliveryOptions::Config.delivery_time_options)[(@order.delivery_date || Date.today).strftime('%A').downcase]
|
27
27
|
.selected-delivery-time{data: @order.delivery_time}
|
28
28
|
= f.label :delivery_time, "Delivery Time"
|
29
|
-
= f.select :delivery_time,
|
29
|
+
= f.select :delivery_time, delivery_options || ""
|
30
30
|
.field
|
31
31
|
= f.label :delivery_instructions, "Delivery Instructions"
|
32
32
|
= f.text_area :delivery_instructions, class: 'fullwidth'
|
@@ -34,6 +34,12 @@ describe Spree::Admin::Orders::DeliveryOptionsController do
|
|
34
34
|
spree_post :update, order: {delivery_date: tomorrow}
|
35
35
|
end
|
36
36
|
|
37
|
+
it 'should call next if update is successful' do
|
38
|
+
order.should_receive(:update_attributes).with({"delivery_date" => tomorrow}).and_return(true)
|
39
|
+
order.should_receive(:next)
|
40
|
+
spree_post :update, order: {delivery_date: tomorrow}
|
41
|
+
end
|
42
|
+
|
37
43
|
it 'should render edit when successful' do
|
38
44
|
spree_post :update, order: {delivery_date: tomorrow}
|
39
45
|
response.should render_template(:edit)
|
@@ -2,7 +2,7 @@
|
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.platform = Gem::Platform::RUBY
|
4
4
|
s.name = 'spree_delivery_options'
|
5
|
-
s.version = '2.1.
|
5
|
+
s.version = '2.1.11'
|
6
6
|
s.summary = 'Adds delivery date and time during checkout'
|
7
7
|
s.description = ''
|
8
8
|
s.required_ruby_version = '>= 2.0.0'
|