spree_core 3.3.0.rc3 → 3.3.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/concerns/spree/default_price.rb +7 -7
- data/app/models/spree/product.rb +16 -5
- data/app/models/spree/refund.rb +1 -1
- data/app/models/spree/variant.rb +4 -3
- data/config/locales/en.yml +1 -1
- data/lib/generators/spree/dummy/dummy_generator.rb +8 -1
- data/lib/generators/spree/install/templates/vendor/assets/javascripts/spree/frontend/all.js +1 -0
- data/lib/spree/core/delegate_belongs_to.rb +4 -0
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/money.rb +10 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2f96bb3309926f006e5d609adee97043e0f1f17
|
4
|
+
data.tar.gz: c511abfe6a45dc6bedf0f98f8492ea6bf7cc895a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3793e4c6c614a61a11f6320c1439d3f23a9939ff44312187b67b4d20c284c05f3ff2bb42fef26bec05706a5efd76dd644b095a2469cc877aa2994fb3b4a7a99
|
7
|
+
data.tar.gz: 87af4d996f9b225d4fa714696812c02c5eb5c66af60693e316e0e31cfe78874341e058efe2d5cbb3fca75cfab0292506bbd184d13b299ccf9cc0552f0f60e11c
|
@@ -8,13 +8,8 @@ module Spree
|
|
8
8
|
class_name: 'Spree::Price',
|
9
9
|
dependent: :destroy
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
:display_amount,
|
14
|
-
:price,
|
15
|
-
:price=,
|
16
|
-
:price_including_vat_for,
|
17
|
-
:currency
|
11
|
+
delegate :display_price, :display_amount, :price, :currency, :price=,
|
12
|
+
:price_including_vat_for, :currency=, to: :find_or_build_default_price
|
18
13
|
|
19
14
|
after_save :save_default_price
|
20
15
|
|
@@ -26,6 +21,11 @@ module Spree
|
|
26
21
|
!self.default_price.nil?
|
27
22
|
end
|
28
23
|
|
24
|
+
|
25
|
+
def find_or_build_default_price
|
26
|
+
default_price || build_default_price
|
27
|
+
end
|
28
|
+
|
29
29
|
private
|
30
30
|
|
31
31
|
def default_price_changed?
|
data/app/models/spree/product.rb
CHANGED
@@ -73,11 +73,6 @@ module Spree
|
|
73
73
|
has_many :line_items, through: :variants_including_master
|
74
74
|
has_many :orders, through: :line_items
|
75
75
|
|
76
|
-
delegate_belongs_to :master, :sku, :price, :currency, :display_amount, :display_price, :weight, :height, :width, :depth,
|
77
|
-
:is_master, :has_default_price?, :cost_currency, :price_in, :amount_in, :cost_price, :images
|
78
|
-
|
79
|
-
alias_method :master_images, :images
|
80
|
-
|
81
76
|
has_many :variant_images, -> { order(:position) }, source: :images, through: :variants_including_master
|
82
77
|
|
83
78
|
after_create :add_associations_from_prototype
|
@@ -118,6 +113,22 @@ module Spree
|
|
118
113
|
self.whitelisted_ransackable_attributes = %w[description name slug discontinue_on]
|
119
114
|
self.whitelisted_ransackable_scopes = %w[not_discontinued]
|
120
115
|
|
116
|
+
[
|
117
|
+
:sku, :price, :currency, :weight, :height, :width, :depth, :is_master,
|
118
|
+
:cost_currency, :price_in, :amount_in, :cost_price
|
119
|
+
].each do |method_name|
|
120
|
+
delegate method_name, :"#{method_name}=", to: :find_or_build_master
|
121
|
+
end
|
122
|
+
|
123
|
+
delegate :display_amount, :display_price, :has_default_price?,
|
124
|
+
:images, to: :find_or_build_master
|
125
|
+
|
126
|
+
alias_method :master_images, :images
|
127
|
+
|
128
|
+
def find_or_build_master
|
129
|
+
master || build_master
|
130
|
+
end
|
131
|
+
|
121
132
|
# the master variant is not a member of the variants array
|
122
133
|
def has_variants?
|
123
134
|
variants.any?
|
data/app/models/spree/refund.rb
CHANGED
@@ -14,7 +14,7 @@ module Spree
|
|
14
14
|
validates :transaction_id, on: :update
|
15
15
|
validates :amount, numericality: { greater_than: 0, allow_nil: true }
|
16
16
|
end
|
17
|
-
validate :amount_is_less_than_or_equal_to_allowed_amount, on: :create
|
17
|
+
validate :amount_is_less_than_or_equal_to_allowed_amount, on: :create, if: :amount
|
18
18
|
|
19
19
|
after_create :perform!
|
20
20
|
after_create :create_log_entry
|
data/app/models/spree/variant.rb
CHANGED
@@ -6,9 +6,8 @@ module Spree
|
|
6
6
|
belongs_to :product, touch: true, class_name: 'Spree::Product', inverse_of: :variants
|
7
7
|
belongs_to :tax_category, class_name: 'Spree::TaxCategory', optional: true
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
:shipping_category
|
9
|
+
delegate :name, :name=, :description, :slug, :available_on, :shipping_category_id,
|
10
|
+
:meta_description, :meta_keywords, :shipping_category, to: :product
|
12
11
|
|
13
12
|
# we need to have this callback before any dependent: :destroy associations
|
14
13
|
# https://github.com/rails/rails/issues/3458
|
@@ -94,6 +93,7 @@ module Spree
|
|
94
93
|
end
|
95
94
|
|
96
95
|
def self.having_orders
|
96
|
+
warn "`Spree::Variant#having_orders` is deprecated and will be removed in Spree 3.4"
|
97
97
|
joins(:line_items).distinct
|
98
98
|
end
|
99
99
|
|
@@ -107,6 +107,7 @@ module Spree
|
|
107
107
|
|
108
108
|
# returns number of units currently on backorder for this variant.
|
109
109
|
def on_backorder
|
110
|
+
warn "`Spree::Variant#on_backorder` is deprecated and will be removed in Spree 3.4"
|
110
111
|
inventory_units.with_state('backordered').size
|
111
112
|
end
|
112
113
|
|
data/config/locales/en.yml
CHANGED
@@ -995,7 +995,7 @@ en:
|
|
995
995
|
order_number: Order %{number}
|
996
996
|
order_processed_successfully: Your order has been processed successfully
|
997
997
|
order_resumed: Order resumed
|
998
|
-
|
998
|
+
order_state:
|
999
999
|
address: address
|
1000
1000
|
awaiting_return: awaiting return
|
1001
1001
|
canceled: canceled
|
@@ -30,7 +30,14 @@ module Spree
|
|
30
30
|
opts[:database] = 'sqlite3' if opts[:database].blank?
|
31
31
|
opts[:force] = true
|
32
32
|
opts[:skip_bundle] = true
|
33
|
-
opts[:
|
33
|
+
opts[:skip_gemfile] = true
|
34
|
+
opts[:skip_git] = true
|
35
|
+
opts[:skip_keeps] = true
|
36
|
+
opts[:skip_listen] = true
|
37
|
+
opts[:skip_rc] = true
|
38
|
+
opts[:skip_spring] = true
|
39
|
+
opts[:skip_test] = true
|
40
|
+
opts[:skip_yarn] = true
|
34
41
|
|
35
42
|
puts "Generating dummy Rails application..."
|
36
43
|
invoke Rails::Generators::AppGenerator,
|
@@ -6,6 +6,7 @@
|
|
6
6
|
//
|
7
7
|
//= require jquery
|
8
8
|
//= require jquery_ujs
|
9
|
+
//= require accounting.min
|
9
10
|
//= require spree/frontend
|
10
11
|
<% unless options[:lib_name] == 'spree' || options[:lib_name] == 'spree/frontend' %>
|
11
12
|
<% filename = "spree/frontend/#{ options[:lib_name].gsub("/", "_") }" %>
|
@@ -32,6 +32,10 @@ module DelegateBelongsTo
|
|
32
32
|
# delegate_belongs_to :contact, [:defaults, :address, :fullname], class_name: 'VCard'
|
33
33
|
##
|
34
34
|
def delegate_belongs_to(association, *attrs)
|
35
|
+
ActiveSupport::Deprecation.warn(<<-EOS, caller)
|
36
|
+
DelegateBelongsTo module is deprecated and will be removed in Spree 3.4
|
37
|
+
EOS
|
38
|
+
|
35
39
|
opts = attrs.extract_options!
|
36
40
|
initialize_association :belongs_to, association, opts
|
37
41
|
attrs = get_association_column_names(association) if attrs.empty?
|
data/lib/spree/core/version.rb
CHANGED
data/lib/spree/money.rb
CHANGED
@@ -40,6 +40,16 @@ module Spree
|
|
40
40
|
to_s
|
41
41
|
end
|
42
42
|
|
43
|
+
def decimal_mark
|
44
|
+
return @money.decimal_mark if @options[:decimal_mark].nil?
|
45
|
+
@options[:decimal_mark]
|
46
|
+
end
|
47
|
+
|
48
|
+
def thousands_separator
|
49
|
+
return @money.thousands_separator if @options[:thousands_separator].nil?
|
50
|
+
@options[:thousands_separator]
|
51
|
+
end
|
52
|
+
|
43
53
|
def ==(obj)
|
44
54
|
@money == obj.money
|
45
55
|
end
|
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: 3.3.0.
|
4
|
+
version: 3.3.0.rc4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Schofield
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemerchant
|
@@ -984,7 +984,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
984
984
|
version: 1.8.23
|
985
985
|
requirements: []
|
986
986
|
rubyforge_project:
|
987
|
-
rubygems_version: 2.6.
|
987
|
+
rubygems_version: 2.6.12
|
988
988
|
signing_key:
|
989
989
|
specification_version: 4
|
990
990
|
summary: The bare bones necessary for Spree.
|