spree_core 2.1.9 → 2.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/helpers/spree/base_helper.rb +2 -1
- data/app/helpers/spree/products_helper.rb +7 -8
- data/app/models/spree/payment_method/check.rb +2 -0
- data/db/migrate/20130611054351_rename_shipping_methods_zones_to_spree_shipping_methods_zones.rb +5 -0
- data/lib/spree/core/controller_helpers/auth.rb +2 -2
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/permitted_attributes.rb +2 -2
- data/lib/spree/promo/coupon_applicator.rb +6 -1
- data/lib/tasks/core.rake +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b54721ddb8bf665a1a369727a7a8d626ab9d250
|
4
|
+
data.tar.gz: 074680d373e2db813366a98a052ffbdef555a5cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15f8c6df2efafb71d4a96a08a49ce73e46ad0fe447bea094017ca8d07ba3828d442cb0d4b1caaf1a365f99a6b200ffec2c106961e4bc690499bb34875476d857
|
7
|
+
data.tar.gz: 587f314371b7e1b0dd636412fd36b504913dd9d8153c69bdaa7061c2d59f639823e6badd4d7ed70845fae0286f36123e47e1d0648b1f3807487ef829ac3bcf1c
|
@@ -164,9 +164,10 @@ module Spree
|
|
164
164
|
end
|
165
165
|
|
166
166
|
private
|
167
|
+
|
167
168
|
# Returns style of image or nil
|
168
169
|
def image_style_from_method_name(method_name)
|
169
|
-
if style = method_name.to_s.sub(/_image$/, '')
|
170
|
+
if method_name.to_s.match(/_image$/) && style = method_name.to_s.sub(/_image$/, '')
|
170
171
|
possible_styles = Spree::Image.attachment_definitions[:attachment][:styles]
|
171
172
|
style if style.in? possible_styles.with_indifferent_access
|
172
173
|
end
|
@@ -12,14 +12,13 @@ module Spree
|
|
12
12
|
|
13
13
|
# returns the formatted price for the specified variant as a difference from product price
|
14
14
|
def variant_price_diff(variant)
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
15
|
+
variant_amount = variant.amount_in(current_currency)
|
16
|
+
product_amount = variant.product.amount_in(current_currency)
|
17
|
+
return if variant_amount == product_amount || product_amount.nil?
|
18
|
+
diff = variant.amount_in(current_currency) - product_amount
|
19
|
+
amount = Spree::Money.new(diff.abs, currency: current_currency).to_html
|
20
|
+
label = diff > 0 ? :add : :subtract
|
21
|
+
"(#{Spree.t(label)}: #{amount})".html_safe
|
23
22
|
end
|
24
23
|
|
25
24
|
# returns the formatted full price for the variant, if at least one variant price differs from product price
|
data/db/migrate/20130611054351_rename_shipping_methods_zones_to_spree_shipping_methods_zones.rb
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
class RenameShippingMethodsZonesToSpreeShippingMethodsZones < ActiveRecord::Migration
|
2
2
|
def change
|
3
3
|
rename_table :shipping_methods_zones, :spree_shipping_methods_zones
|
4
|
+
# If Spree::ShippingMethod zones association was patched in
|
5
|
+
# CreateShippingMethodZone migrations, it needs to be patched back
|
6
|
+
Spree::ShippingMethod.has_and_belongs_to_many :zones, :join_table => 'spree_shipping_methods_zones',
|
7
|
+
:class_name => 'Spree::Zone',
|
8
|
+
:foreign_key => 'shipping_method_id'
|
4
9
|
end
|
5
10
|
end
|
@@ -8,7 +8,7 @@ module Spree
|
|
8
8
|
helper_method :try_spree_current_user
|
9
9
|
|
10
10
|
rescue_from CanCan::AccessDenied do |exception|
|
11
|
-
|
11
|
+
redirect_unauthorized_access
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -20,7 +20,7 @@ module Spree
|
|
20
20
|
# Redirect as appropriate when an access request fails. The default action is to redirect to the login screen.
|
21
21
|
# Override this method in your controllers if you want to have special behavior in case the user is not authorized
|
22
22
|
# to access the requested action. For example, a popup window might simply close itself.
|
23
|
-
def
|
23
|
+
def redirect_unauthorized_access
|
24
24
|
if try_spree_current_user
|
25
25
|
flash[:error] = Spree.t(:authorization_failure)
|
26
26
|
redirect_to '/unauthorized'
|
data/lib/spree/core/version.rb
CHANGED
@@ -27,7 +27,7 @@ module Spree
|
|
27
27
|
mattr_reader *ATTRIBUTES
|
28
28
|
|
29
29
|
@@address_attributes = [
|
30
|
-
:firstname, :lastname, :address1, :address2,
|
30
|
+
:id, :firstname, :lastname, :address1, :address2,
|
31
31
|
:city, :country_id, :state_id, :zipcode, :phone,
|
32
32
|
:state_name, :alternative_phone, :company,
|
33
33
|
:country => [:iso, :name, :iso3, :iso_name],
|
@@ -68,7 +68,7 @@ module Spree
|
|
68
68
|
# month / year may be provided by some sources, or others may elect to use one field
|
69
69
|
@@source_attributes = [
|
70
70
|
:number, :month, :year, :expiry, :verification_value,
|
71
|
-
:first_name, :last_name, :cc_type, :gateway_customer_profile_id,
|
71
|
+
:first_name, :last_name, :cc_type, :gateway_customer_profile_id,
|
72
72
|
:gateway_payment_profile_id, :last_digits, :name]
|
73
73
|
|
74
74
|
@@stock_item_attributes = [:variant, :stock_location, :backorderable, :variant_id]
|
@@ -34,7 +34,12 @@ module Spree
|
|
34
34
|
event_name = "spree.checkout.coupon_code_added"
|
35
35
|
if promotion.activate(:coupon_code => @order.coupon_code, :order => @order)
|
36
36
|
promo = @order.adjustments.includes(:originator).promotion.detect { |p| p.originator.promotion.code == @order.coupon_code }
|
37
|
-
|
37
|
+
if promo.present?
|
38
|
+
determine_promotion_application_result(promo)
|
39
|
+
else
|
40
|
+
# if action is create line items
|
41
|
+
return { :coupon_applied? => true, :success => Spree.t(:coupon_code_applied) }
|
42
|
+
end
|
38
43
|
else
|
39
44
|
return { :coupon_applied? => false, :error => Spree.t(:coupon_code_not_eligible) }
|
40
45
|
end
|
data/lib/tasks/core.rake
CHANGED
@@ -86,8 +86,8 @@ use rake db:load_file[/absolute/path/to/sample/filename.rb]}
|
|
86
86
|
end
|
87
87
|
|
88
88
|
if load_sample
|
89
|
-
#
|
90
|
-
|
89
|
+
# Reload models' attributes in case they were loaded in old migrations with wrong attributes
|
90
|
+
ActiveRecord::Base.descendants.each(&:reset_column_information)
|
91
91
|
Rake::Task["spree_sample:load"].invoke
|
92
92
|
end
|
93
93
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Schofield
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|
@@ -212,14 +212,14 @@ dependencies:
|
|
212
212
|
requirements:
|
213
213
|
- - "~>"
|
214
214
|
- !ruby/object:Gem::Version
|
215
|
-
version: 4.0.
|
215
|
+
version: 4.0.12
|
216
216
|
type: :runtime
|
217
217
|
prerelease: false
|
218
218
|
version_requirements: !ruby/object:Gem::Requirement
|
219
219
|
requirements:
|
220
220
|
- - "~>"
|
221
221
|
- !ruby/object:Gem::Version
|
222
|
-
version: 4.0.
|
222
|
+
version: 4.0.12
|
223
223
|
- !ruby/object:Gem::Dependency
|
224
224
|
name: ransack
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|