caboose-cms 0.9.27 → 0.9.28
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e874f1cc3a49bfb9ca519da804aaef5c4da22b2
|
4
|
+
data.tar.gz: dfd0a6d5d8579bf3e507b6c695b87c971f819946
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d53a02acd2f30c9e96127f450dd23904c6dae8b15ae8dc3567e3fd0e403d832c6f1f674416319325e2dea4546487965962ad0f6994853cd1f04f2951e0d024a
|
7
|
+
data.tar.gz: 0e24809540ebf8edafed45437328a6403dc156dea7a8ef0a6bcae3fc46cb27ec4d1dbb67d9de3141f8733b90fc6ea86315e004d0f1c3d0bf76a6a324b2686a82
|
@@ -39,8 +39,8 @@ module Caboose
|
|
39
39
|
c = VariantLimit.new
|
40
40
|
c.user_id = params[:user_id]
|
41
41
|
c.variant_id = params[:variant_id]
|
42
|
-
c.
|
43
|
-
c.
|
42
|
+
c.min_quantity_value = 0
|
43
|
+
c.max_quantity_value = 0
|
44
44
|
c.current_value = 0
|
45
45
|
c.save
|
46
46
|
resp.success = true
|
@@ -58,11 +58,13 @@ module Caboose
|
|
58
58
|
|
59
59
|
params.each do |k,v|
|
60
60
|
case k
|
61
|
-
when "user_id"
|
62
|
-
when "variant_id"
|
63
|
-
when "
|
64
|
-
when "
|
65
|
-
when "
|
61
|
+
when "user_id" then variantlimit.user_id = v
|
62
|
+
when "variant_id" then variantlimit.variant_id = v
|
63
|
+
when "min_quantity_value" then variantlimit.min_quantity_value = v
|
64
|
+
when "min_quantity_func" then variantlimit.min_quantity_func = v
|
65
|
+
when "max_quantity_value" then variantlimit.max_quantity_value = v
|
66
|
+
when "max_quantity_func" then variantlimit.max_quantity_func = v
|
67
|
+
when "current_value" then variantlimit.current_value = v
|
66
68
|
end
|
67
69
|
end
|
68
70
|
|
@@ -31,7 +31,7 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
31
31
|
Caboose::InvoiceTransaction => { :order_id => :invoice_id },
|
32
32
|
Caboose::LineItem => { :order_id => :invoice_id, :order_package_id => :invoice_package_id },
|
33
33
|
Caboose::RetargetingConfig => { :conversion_id => :google_conversion_id, :labels_function => :google_labels_function },
|
34
|
-
Caboose::StoreConfig => { :starting_order_number => :starting_invoice_number }
|
34
|
+
Caboose::StoreConfig => { :starting_order_number => :starting_invoice_number }
|
35
35
|
}
|
36
36
|
end
|
37
37
|
|
@@ -96,6 +96,7 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
96
96
|
Caboose::Site => [:shipping_cost_function],
|
97
97
|
Caboose::StoreConfig => [:use_usps, :allowed_shipping_codes, :default_shipping_code, :pp_relay_url, :pp_response_url],
|
98
98
|
Caboose::Variant => [:quantity, :on_sale],
|
99
|
+
Caboose::VariantLimit => [:min_quantity, :max_quantity],
|
99
100
|
Caboose::Vendor => [:vendor, :vendor_id]
|
100
101
|
}
|
101
102
|
end
|
@@ -972,11 +973,15 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
972
973
|
[ :is_bundle , :boolean , { :default => false }]
|
973
974
|
],
|
974
975
|
Caboose::VariantLimit => [
|
975
|
-
[ :variant_id
|
976
|
-
[ :user_id
|
977
|
-
[ :min_quantity
|
978
|
-
[ :max_quantity
|
979
|
-
[ :
|
976
|
+
[ :variant_id , :integer ],
|
977
|
+
[ :user_id , :integer ],
|
978
|
+
#[ :min_quantity , :integer ],
|
979
|
+
#[ :max_quantity , :integer ],
|
980
|
+
[ :min_quantity_value , :integer ],
|
981
|
+
[ :min_quantity_func , :text ],
|
982
|
+
[ :max_quantity_value , :integer ],
|
983
|
+
[ :max_quantity_func , :text ],
|
984
|
+
[ :current_value , :integer ]
|
980
985
|
],
|
981
986
|
Caboose::Vendor => [
|
982
987
|
[ :site_id , :integer ],
|
@@ -4,13 +4,25 @@ module Caboose
|
|
4
4
|
|
5
5
|
belongs_to :variant
|
6
6
|
belongs_to :user
|
7
|
-
attr_accessible :id
|
8
|
-
:variant_id
|
9
|
-
:user_id
|
10
|
-
:
|
11
|
-
:
|
7
|
+
attr_accessible :id ,
|
8
|
+
:variant_id ,
|
9
|
+
:user_id ,
|
10
|
+
:min_quantity_value ,
|
11
|
+
:min_quantity_func ,
|
12
|
+
:max_quantity_value ,
|
13
|
+
:max_quantity_func ,
|
12
14
|
:current_value
|
13
15
|
|
16
|
+
def min_quantity
|
17
|
+
return self.min_quantity_value if self.min_quantity_func.nil? || self.min_quantity_func.strip.length == 0
|
18
|
+
return eval(self.min_quantity_func)
|
19
|
+
end
|
20
|
+
|
21
|
+
def max_quantity
|
22
|
+
return self.max_quantity_value if self.max_quantity_func.nil? || self.max_quantity_func.strip.length == 0
|
23
|
+
return eval(self.max_quantity_func)
|
24
|
+
end
|
25
|
+
|
14
26
|
def quantity_message
|
15
27
|
if self.min_quantity == 0 && self.max_quantity == 0
|
16
28
|
return "You are not allowed to purchase this item."
|
@@ -48,3 +60,4 @@ module Caboose
|
|
48
60
|
|
49
61
|
end
|
50
62
|
end
|
63
|
+
|
data/lib/caboose/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caboose-cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.28
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Barry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|