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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 000257197aa4e88e1516c66905ca43adc002d988
4
- data.tar.gz: b5913ede5baedf31a6a47dae371eb5bf6a8b473a
3
+ metadata.gz: ef69bf63aeb1d23e1d531f2da3b22182ab58385f
4
+ data.tar.gz: 1af6ca42e5e13278d330fe7aadedc25b94b466ef
5
5
  SHA512:
6
- metadata.gz: e874be45553226c30884289810d0d03826cbfe2e5eaea382c14cd02fc3d6daf77b89b136eba270a0d635664d779deef728ade7944e8b78715da97d1328c5fc64
7
- data.tar.gz: 1797709d7fe53097b81a8b256a70fb3cb975f2cd6c5287e216f0220529b3991d5b73b5b6c1f53f6fb86f01e18757134c91008577d8f55738837fed8fb2973849
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
- - selected_delivery_day = (@order.delivery_date || Date.today).strftime('%A').downcase
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, JSON.parse(SpreeDeliveryOptions::Config.delivery_time_options)[selected_delivery_day]
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.10'
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'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_delivery_options
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.10
4
+ version: 2.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francisco Trindade