spree_core 0.60.0 → 0.60.1
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/admin/base_controller.rb +7 -0
- data/app/controllers/admin/payments_controller.rb +1 -1
- data/app/controllers/admin/product_properties_controller.rb +1 -1
- data/app/controllers/admin/resource_controller.rb +3 -9
- data/app/controllers/admin/shipments_controller.rb +2 -2
- data/app/controllers/admin/taxons_controller.rb +1 -1
- data/app/controllers/checkout_controller.rb +2 -1
- data/app/models/order.rb +2 -1
- data/app/models/shipping_method.rb +1 -0
- data/app/views/admin/product_properties/index.html.erb +1 -1
- data/app/views/checkout/_confirm.html.erb +1 -1
- data/app/views/checkout/edit.html.erb +5 -3
- data/lib/spree_core/railtie.rb +5 -0
- data/lib/spree_core/testing_support/factories/shipping_method_factory.rb +7 -3
- data/lib/spree_core/version.rb +1 -1
- metadata +66 -65
@@ -6,6 +6,13 @@ class Admin::BaseController < Spree::BaseController
|
|
6
6
|
layout 'admin'
|
7
7
|
|
8
8
|
protected
|
9
|
+
|
10
|
+
def flash_message_for(object, event_sym)
|
11
|
+
resource_desc = object.class.model_name.human
|
12
|
+
resource_desc += " \"#{object.name}\"" if object.respond_to?(:name)
|
13
|
+
I18n.t(event_sym, :resource => resource_desc)
|
14
|
+
end
|
15
|
+
|
9
16
|
def render_js_for_destroy
|
10
17
|
render :partial => "/admin/shared/destroy"
|
11
18
|
end
|
@@ -30,7 +30,7 @@ class Admin::PaymentsController < Admin::BaseController
|
|
30
30
|
|
31
31
|
if @order.completed?
|
32
32
|
@payment.process!
|
33
|
-
flash[:notice] =
|
33
|
+
flash[:notice] = flash_message_for(@payment, :successfully_created)
|
34
34
|
|
35
35
|
respond_with(@payment) { |format| format.html { redirect_to admin_order_payments_path(@order) } }
|
36
36
|
else
|
@@ -24,9 +24,7 @@ class Admin::ResourceController < Admin::BaseController
|
|
24
24
|
invoke_callbacks(:update, :before)
|
25
25
|
if @object.update_attributes(params[object_name])
|
26
26
|
invoke_callbacks(:update, :after)
|
27
|
-
|
28
|
-
resource_desc += " \"#{@object.name}\"" if @object.respond_to?(:name)
|
29
|
-
flash[:notice] = I18n.t(:successfully_updated, :resource => resource_desc)
|
27
|
+
flash[:notice] = flash_message_for(@object, :successfully_updated)
|
30
28
|
respond_with(@object) do |format|
|
31
29
|
format.html { redirect_to location_after_save }
|
32
30
|
format.js { render :layout => false }
|
@@ -41,9 +39,7 @@ class Admin::ResourceController < Admin::BaseController
|
|
41
39
|
invoke_callbacks(:create, :before)
|
42
40
|
if @object.save
|
43
41
|
invoke_callbacks(:create, :after)
|
44
|
-
|
45
|
-
resource_desc += " \"#{@object.name}\"" if @object.respond_to?(:name)
|
46
|
-
flash[:notice] = I18n.t(:successfully_created, :resource => resource_desc)
|
42
|
+
flash[:notice] = flash_message_for(@object, :successfully_created)
|
47
43
|
respond_with(@object) do |format|
|
48
44
|
format.html { redirect_to location_after_save }
|
49
45
|
format.js { render :layout => false }
|
@@ -58,9 +54,7 @@ class Admin::ResourceController < Admin::BaseController
|
|
58
54
|
invoke_callbacks(:destroy, :before)
|
59
55
|
if @object.destroy
|
60
56
|
invoke_callbacks(:destroy, :after)
|
61
|
-
|
62
|
-
resource_desc += " \"#{@object.name}\"" if @object.respond_to?(:name)
|
63
|
-
flash[:notice] = I18n.t(:successfully_removed, :resource => resource_desc)
|
57
|
+
flash[:notice] = flash_message_for(@object, :successfully_removed)
|
64
58
|
respond_with(@object) do |format|
|
65
59
|
format.html { redirect_to collection_url }
|
66
60
|
format.js { render :partial => "/admin/shared/destroy" }
|
@@ -22,7 +22,7 @@ class Admin::ShipmentsController < Admin::BaseController
|
|
22
22
|
build_shipment
|
23
23
|
assign_inventory_units
|
24
24
|
if @shipment.save
|
25
|
-
flash[:notice] =
|
25
|
+
flash[:notice] = flash_message_for(@shipment, :successfully_created)
|
26
26
|
respond_with(@shipment) do |format|
|
27
27
|
format.html { redirect_to edit_admin_order_shipment_path(@order, @shipment) }
|
28
28
|
end
|
@@ -44,7 +44,7 @@ class Admin::ShipmentsController < Admin::BaseController
|
|
44
44
|
@order.shipping_method = @order.shipment.shipping_method
|
45
45
|
@order.save
|
46
46
|
|
47
|
-
flash[:notice] =
|
47
|
+
flash[:notice] = flash_message_for(@shipment, :successfully_updated)
|
48
48
|
return_path = @order.completed? ? edit_admin_order_shipment_path(@order, @shipment) : admin_order_adjustments_path(@order)
|
49
49
|
respond_with(@object) do |format|
|
50
50
|
format.html { redirect_to return_path }
|
@@ -85,7 +85,7 @@ class Admin::TaxonsController < Admin::BaseController
|
|
85
85
|
@update_children = true if params[:taxon][:name] != @taxon.name || params[:taxon][:permalink] != @taxon.permalink
|
86
86
|
|
87
87
|
if @taxon.update_attributes(params[:taxon])
|
88
|
-
flash[:notice] =
|
88
|
+
flash[:notice] = flash_message_for(@taxon, :successfully_updated)
|
89
89
|
end
|
90
90
|
|
91
91
|
#rename child taxons
|
@@ -16,7 +16,8 @@ class CheckoutController < Spree::BaseController
|
|
16
16
|
state_callback(:after)
|
17
17
|
else
|
18
18
|
flash[:error] = I18n.t(:payment_processing_failed)
|
19
|
-
respond_with(@order, :location => checkout_state_path(@order.state))
|
19
|
+
respond_with(@order, :location => checkout_state_path(@order.state))
|
20
|
+
return
|
20
21
|
end
|
21
22
|
|
22
23
|
if @order.state == "complete" || @order.completed?
|
data/app/models/order.rb
CHANGED
@@ -26,7 +26,8 @@ class Order < ActiveRecord::Base
|
|
26
26
|
before_create :create_user
|
27
27
|
before_create :generate_order_number
|
28
28
|
|
29
|
-
|
29
|
+
# TODO: validate the format of the email as well (but we can't rely on authlogic anymore to help with validation)
|
30
|
+
validates :email, :presence => true, :format => /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i, :if => :require_email
|
30
31
|
validate :has_available_shipment
|
31
32
|
|
32
33
|
#delegate :ip_address, :to => :checkout
|
@@ -42,7 +42,7 @@
|
|
42
42
|
<% end %>
|
43
43
|
|
44
44
|
<%= javascript_tag do %>
|
45
|
-
var properties =
|
45
|
+
var properties = [<%= @properties.map{|id| "'#{id}'"}.join(', ') %>];
|
46
46
|
|
47
47
|
$("#product_properties input.autocomplete").live("keydown", function(){
|
48
48
|
already_auto_completed = $(this).is('ac_input');
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<fieldset id="order_details">
|
2
2
|
<div class="clear"></div>
|
3
|
-
<legend><%= t(
|
3
|
+
<legend><%= t(@order.state, :scope => :order_state).titleize %></legend>
|
4
4
|
<%= render :partial => 'shared/order_details', :locals => {:order => @order} %>
|
5
5
|
</fieldset>
|
6
6
|
|
@@ -7,9 +7,11 @@
|
|
7
7
|
<br clear="left" />
|
8
8
|
<%= render "shared/error_messages", :target => @order %>
|
9
9
|
<%= hook :checkout_summary_box do %>
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
<% if @order.state != 'confirm' %>
|
11
|
+
<div id="checkout-summary">
|
12
|
+
<%= render 'summary', :order => @order %>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
13
15
|
<% end %>
|
14
16
|
<%= form_for @order, :url => update_checkout_path(@order.state), :html => { :id => "checkout_form_#{@order.state}" } do |form| %>
|
15
17
|
<%= render @order.state, :form => form %>
|
data/lib/spree_core/railtie.rb
CHANGED
@@ -54,5 +54,10 @@ module SpreeCore
|
|
54
54
|
|
55
55
|
config.to_prepare &method(:activate).to_proc
|
56
56
|
|
57
|
+
# filter sensitive information during logging
|
58
|
+
initializer "spree.params.filter" do |app|
|
59
|
+
app.config.filter_parameters += [:password, :password_confirmation, :number]
|
60
|
+
end
|
61
|
+
|
57
62
|
end
|
58
63
|
end
|
@@ -1,7 +1,11 @@
|
|
1
1
|
Factory.define :shipping_method do |f|
|
2
2
|
f.zone {|a| Zone.find_by_name("GlobalZone") || a.association(:global_zone) }
|
3
3
|
f.name 'UPS Ground'
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
f.calculator { |sm| Factory(:calculator, :calculable_id => sm.object_id, :calculable_type => "ShippingMethod") }
|
5
|
+
end
|
6
|
+
|
7
|
+
Factory.define :free_shipping_method, :class => ShippingMethod do |f|
|
8
|
+
f.zone {|a| Zone.find_by_name("GlobalZone") || a.association(:global_zone) }
|
9
|
+
f.name 'UPS Ground'
|
10
|
+
f.calculator { |sm| Factory(:no_amount_calculator, :calculable_id => sm.object_id, :calculable_type => "ShippingMethod") }
|
7
11
|
end
|
data/lib/spree_core/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 237
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 60
|
9
|
-
-
|
10
|
-
version: 0.60.
|
9
|
+
- 1
|
10
|
+
version: 0.60.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sean Schofield
|
@@ -15,12 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-06-21 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
23
|
-
prerelease: false
|
22
|
+
type: :runtime
|
24
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
24
|
none: false
|
26
25
|
requirements:
|
@@ -32,27 +31,27 @@ dependencies:
|
|
32
31
|
- 1
|
33
32
|
- 2
|
34
33
|
version: 0.1.2
|
35
|
-
type: :runtime
|
36
34
|
version_requirements: *id001
|
37
|
-
|
38
|
-
name: nested_set
|
35
|
+
name: acts_as_list
|
39
36
|
prerelease: false
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
type: :runtime
|
40
39
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
40
|
none: false
|
42
41
|
requirements:
|
43
42
|
- - "="
|
44
43
|
- !ruby/object:Gem::Version
|
45
|
-
hash:
|
44
|
+
hash: 3
|
46
45
|
segments:
|
47
46
|
- 1
|
48
47
|
- 6
|
49
|
-
-
|
50
|
-
version: 1.6.
|
51
|
-
type: :runtime
|
48
|
+
- 6
|
49
|
+
version: 1.6.6
|
52
50
|
version_requirements: *id002
|
53
|
-
|
54
|
-
name: rd_unobtrusive_date_picker
|
51
|
+
name: nested_set
|
55
52
|
prerelease: false
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
type: :runtime
|
56
55
|
requirement: &id003 !ruby/object:Gem::Requirement
|
57
56
|
none: false
|
58
57
|
requirements:
|
@@ -64,11 +63,11 @@ dependencies:
|
|
64
63
|
- 1
|
65
64
|
- 0
|
66
65
|
version: 0.1.0
|
67
|
-
type: :runtime
|
68
66
|
version_requirements: *id003
|
69
|
-
|
70
|
-
name: rd_find_by_param
|
67
|
+
name: rd_unobtrusive_date_picker
|
71
68
|
prerelease: false
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
type: :runtime
|
72
71
|
requirement: &id004 !ruby/object:Gem::Requirement
|
73
72
|
none: false
|
74
73
|
requirements:
|
@@ -80,11 +79,11 @@ dependencies:
|
|
80
79
|
- 1
|
81
80
|
- 1
|
82
81
|
version: 0.1.1
|
83
|
-
type: :runtime
|
84
82
|
version_requirements: *id004
|
85
|
-
|
86
|
-
name: highline
|
83
|
+
name: rd_find_by_param
|
87
84
|
prerelease: false
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
type: :runtime
|
88
87
|
requirement: &id005 !ruby/object:Gem::Requirement
|
89
88
|
none: false
|
90
89
|
requirements:
|
@@ -96,11 +95,11 @@ dependencies:
|
|
96
95
|
- 5
|
97
96
|
- 1
|
98
97
|
version: 1.5.1
|
99
|
-
type: :runtime
|
100
98
|
version_requirements: *id005
|
101
|
-
|
102
|
-
name: stringex
|
99
|
+
name: highline
|
103
100
|
prerelease: false
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
type: :runtime
|
104
103
|
requirement: &id006 !ruby/object:Gem::Requirement
|
105
104
|
none: false
|
106
105
|
requirements:
|
@@ -112,11 +111,11 @@ dependencies:
|
|
112
111
|
- 0
|
113
112
|
- 3
|
114
113
|
version: 1.0.3
|
115
|
-
type: :runtime
|
116
114
|
version_requirements: *id006
|
117
|
-
|
118
|
-
name: state_machine
|
115
|
+
name: stringex
|
119
116
|
prerelease: false
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
type: :runtime
|
120
119
|
requirement: &id007 !ruby/object:Gem::Requirement
|
121
120
|
none: false
|
122
121
|
requirements:
|
@@ -128,11 +127,11 @@ dependencies:
|
|
128
127
|
- 9
|
129
128
|
- 4
|
130
129
|
version: 0.9.4
|
131
|
-
type: :runtime
|
132
130
|
version_requirements: *id007
|
133
|
-
|
134
|
-
name: faker
|
131
|
+
name: state_machine
|
135
132
|
prerelease: false
|
133
|
+
- !ruby/object:Gem::Dependency
|
134
|
+
type: :runtime
|
136
135
|
requirement: &id008 !ruby/object:Gem::Requirement
|
137
136
|
none: false
|
138
137
|
requirements:
|
@@ -144,27 +143,27 @@ dependencies:
|
|
144
143
|
- 9
|
145
144
|
- 5
|
146
145
|
version: 0.9.5
|
147
|
-
type: :runtime
|
148
146
|
version_requirements: *id008
|
149
|
-
|
150
|
-
name: paperclip
|
147
|
+
name: faker
|
151
148
|
prerelease: false
|
149
|
+
- !ruby/object:Gem::Dependency
|
150
|
+
type: :runtime
|
152
151
|
requirement: &id009 !ruby/object:Gem::Requirement
|
153
152
|
none: false
|
154
153
|
requirements:
|
155
154
|
- - "="
|
156
155
|
- !ruby/object:Gem::Version
|
157
|
-
hash:
|
156
|
+
hash: 21
|
158
157
|
segments:
|
159
158
|
- 2
|
160
159
|
- 3
|
161
|
-
-
|
162
|
-
version: 2.3.
|
163
|
-
type: :runtime
|
160
|
+
- 11
|
161
|
+
version: 2.3.11
|
164
162
|
version_requirements: *id009
|
165
|
-
|
166
|
-
name: rd_resource_controller
|
163
|
+
name: paperclip
|
167
164
|
prerelease: false
|
165
|
+
- !ruby/object:Gem::Dependency
|
166
|
+
type: :runtime
|
168
167
|
requirement: &id010 !ruby/object:Gem::Requirement
|
169
168
|
none: false
|
170
169
|
requirements:
|
@@ -174,11 +173,11 @@ dependencies:
|
|
174
173
|
segments:
|
175
174
|
- 0
|
176
175
|
version: "0"
|
177
|
-
type: :runtime
|
178
176
|
version_requirements: *id010
|
179
|
-
|
180
|
-
name: meta_search
|
177
|
+
name: rd_resource_controller
|
181
178
|
prerelease: false
|
179
|
+
- !ruby/object:Gem::Dependency
|
180
|
+
type: :runtime
|
182
181
|
requirement: &id011 !ruby/object:Gem::Requirement
|
183
182
|
none: false
|
184
183
|
requirements:
|
@@ -190,59 +189,60 @@ dependencies:
|
|
190
189
|
- 0
|
191
190
|
- 5
|
192
191
|
version: 1.0.5
|
193
|
-
type: :runtime
|
194
192
|
version_requirements: *id011
|
195
|
-
|
196
|
-
name: activemerchant
|
193
|
+
name: meta_search
|
197
194
|
prerelease: false
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
type: :runtime
|
198
197
|
requirement: &id012 !ruby/object:Gem::Requirement
|
199
198
|
none: false
|
200
199
|
requirements:
|
201
200
|
- - "="
|
202
201
|
- !ruby/object:Gem::Version
|
203
|
-
hash:
|
202
|
+
hash: 43
|
204
203
|
segments:
|
205
204
|
- 1
|
206
|
-
-
|
205
|
+
- 15
|
207
206
|
- 0
|
208
|
-
version: 1.
|
209
|
-
type: :runtime
|
207
|
+
version: 1.15.0
|
210
208
|
version_requirements: *id012
|
211
|
-
|
212
|
-
name: will_paginate
|
209
|
+
name: activemerchant
|
213
210
|
prerelease: false
|
211
|
+
- !ruby/object:Gem::Dependency
|
212
|
+
type: :runtime
|
214
213
|
requirement: &id013 !ruby/object:Gem::Requirement
|
215
214
|
none: false
|
216
215
|
requirements:
|
217
216
|
- - "="
|
218
217
|
- !ruby/object:Gem::Version
|
219
|
-
hash:
|
218
|
+
hash: 1923831917
|
220
219
|
segments:
|
221
220
|
- 3
|
222
221
|
- 0
|
223
|
-
-
|
222
|
+
- pre
|
223
|
+
- 2
|
224
224
|
version: 3.0.pre2
|
225
|
-
type: :runtime
|
226
225
|
version_requirements: *id013
|
227
|
-
|
228
|
-
name: rails
|
226
|
+
name: will_paginate
|
229
227
|
prerelease: false
|
228
|
+
- !ruby/object:Gem::Dependency
|
229
|
+
type: :runtime
|
230
230
|
requirement: &id014 !ruby/object:Gem::Requirement
|
231
231
|
none: false
|
232
232
|
requirements:
|
233
233
|
- - "="
|
234
234
|
- !ruby/object:Gem::Version
|
235
|
-
hash:
|
235
|
+
hash: 21
|
236
236
|
segments:
|
237
237
|
- 3
|
238
238
|
- 0
|
239
|
-
-
|
240
|
-
version: 3.0.
|
241
|
-
type: :runtime
|
239
|
+
- 9
|
240
|
+
version: 3.0.9
|
242
241
|
version_requirements: *id014
|
243
|
-
|
244
|
-
name: jquery-rails
|
242
|
+
name: rails
|
245
243
|
prerelease: false
|
244
|
+
- !ruby/object:Gem::Dependency
|
245
|
+
type: :runtime
|
246
246
|
requirement: &id015 !ruby/object:Gem::Requirement
|
247
247
|
none: false
|
248
248
|
requirements:
|
@@ -254,8 +254,9 @@ dependencies:
|
|
254
254
|
- 2
|
255
255
|
- 6
|
256
256
|
version: 0.2.6
|
257
|
-
type: :runtime
|
258
257
|
version_requirements: *id015
|
258
|
+
name: jquery-rails
|
259
|
+
prerelease: false
|
259
260
|
description: Required dependancy for Spree
|
260
261
|
email: sean@railsdog.com
|
261
262
|
executables: []
|
@@ -1142,7 +1143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1142
1143
|
requirements:
|
1143
1144
|
- none
|
1144
1145
|
rubyforge_project: spree_core
|
1145
|
-
rubygems_version: 1.
|
1146
|
+
rubygems_version: 1.6.2
|
1146
1147
|
signing_key:
|
1147
1148
|
specification_version: 3
|
1148
1149
|
summary: Core e-commerce functionality for the Spree project.
|