caboose-store 0.0.28 → 0.0.29
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 +8 -8
- data/app/assets/javascripts/caboose_store/modules/product.js +2 -2
- data/app/controllers/caboose_store/variants_controller.rb +2 -2
- data/app/models/caboose_store/line_item.rb +1 -1
- data/app/models/caboose_store/order.rb +2 -2
- data/lib/caboose-store/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTExODk3Njk5MjRkYWYxYWRmODgxZWM3OTUyNDM0OWY5NGI1YzI0Zg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MDhkMTUzN2QyZDk4MzQwOWVkYWIxZTk5NTU1MmZhN2M3NmVhYzY2MQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NWMzYzM3NzRlNDYxYjM5YzQ3YTg5YTgxMmQzZTM5NzdkNDU4NjFlYTMwMjlh
|
10
|
+
NzE2NDIzYzBiZDY0N2I1MGMxOTc4YTc1OTU3ZmI5OWZiZmQ4ZjdkOWEyODli
|
11
|
+
NmQwNTY0MzgyMTgyOTRjZTE4NzI3YTY2ZTI0NmRlYmRhMWZmZjg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
N2EyZTM3N2E4ODEyYzNlMTdhOWJkNDllN2I3YzdmZmJiYTA1Y2VlOTVjMjc0
|
14
|
+
ZGUwMjBjNmRmNTk4ZTlkY2U2NzU3MzQ4NDU4YjVhZTVhZDczMDFkN2M2ZGMy
|
15
|
+
ODA4OGQzYWVkMmJhNGQyMTU1NGIxNmM3MjIxNDQzYTljZmE5ZmM=
|
@@ -233,7 +233,7 @@ Caboose.Store.Modules.Product = (function() {
|
|
233
233
|
|
234
234
|
self.getInitialVariant = function () {
|
235
235
|
var variant = _.find(self.product.variants, function(variant) {
|
236
|
-
return variant.
|
236
|
+
return variant.quantity_in_stock > 0;
|
237
237
|
});
|
238
238
|
|
239
239
|
if (!variant) {
|
@@ -252,7 +252,7 @@ Caboose.Store.Modules.Product = (function() {
|
|
252
252
|
}));
|
253
253
|
|
254
254
|
var variants = _.sortBy(_.where(self.product.variants, attributes), function(variant) { return variant.price });
|
255
|
-
return _.find(variants, function(variant) { return variant.
|
255
|
+
return _.find(variants, function(variant) { return variant.quantity_in_stock > 0 });
|
256
256
|
};
|
257
257
|
|
258
258
|
self.setOptionsFromVariant = function(variant) {
|
@@ -96,8 +96,8 @@ module CabooseStore
|
|
96
96
|
v.barcode = value
|
97
97
|
when 'price'
|
98
98
|
v.price = value
|
99
|
-
when '
|
100
|
-
v.
|
99
|
+
when 'quantity_in_stock'
|
100
|
+
v.quantity_in_stock = value
|
101
101
|
when 'ignore_quantity'
|
102
102
|
v.ignore_quantity = value
|
103
103
|
when 'allow_backorder'
|
@@ -39,7 +39,7 @@ module CabooseStore
|
|
39
39
|
|
40
40
|
validate :quantity_in_stock
|
41
41
|
def quantity_in_stock
|
42
|
-
errors.add(:base, "There #{self.variant.
|
42
|
+
errors.add(:base, "There #{self.variant.quantity_in_stock > 1 ? 'are' : 'is'} only #{self.variant.quantity_in_stock} left in stock.") if self.variant.quantity_in_stock - self.quantity < 0
|
43
43
|
end
|
44
44
|
|
45
45
|
#
|
@@ -103,7 +103,7 @@ module CabooseStore
|
|
103
103
|
return false if self.decremented
|
104
104
|
|
105
105
|
self.line_items.each do |line_item|
|
106
|
-
line_item.variant.update_attribute(:
|
106
|
+
line_item.variant.update_attribute(:quantity, line_item.variant.quantity_in_stock - line_item.quantity)
|
107
107
|
end
|
108
108
|
|
109
109
|
self.update_attribute(:decremented, true)
|
@@ -113,7 +113,7 @@ module CabooseStore
|
|
113
113
|
return false if !self.decremented
|
114
114
|
|
115
115
|
self.line_items.each do |line_item|
|
116
|
-
line_item.variant.update_attribute(:quantity, line_item.variant.
|
116
|
+
line_item.variant.update_attribute(:quantity, line_item.variant.quantity_in_stock - line_item.quantity)
|
117
117
|
end
|
118
118
|
|
119
119
|
self.update_attribute(:decremented, false)
|