caboose-store 0.0.42 → 0.0.43
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Y2E4NmY4NDlmY2NjNDRjNzdlYjhlODIzYzA3ZWVlZWUxZTczYjZkZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OWZmMGYyODQ0ZTExMTM2MmMzZmFhMDg1NjY4MTAwMjIzNzE3NTRlNw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
M2U4MWMxZTc5ODRhMWRiMGQyODJmOGM2MGFmYjEzM2NhNDE4MzA5MDJhNjA1
|
10
|
+
YTJjMDI5YzhkMWE3NTE1NmViNDAxYTc1OTBkYjhmMDAxNjU1ODUzZTdjN2Qw
|
11
|
+
YjRjZTY5YmNkNDdiYTMwNmU3ZGI4Y2Q1M2RiNTA2ZDEyYzM2OGU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTRjYjI0YTE3ZjY2MDU5NGQ3YWE3ODg4NzMwNThjYTVkOGNmZWE2MmJjNDM0
|
14
|
+
YTVjOGE0MjcxZTc5MTE4ODkxODczNTQxNmU1M2RlNzM5MjhmNDJiNmI4Nzcx
|
15
|
+
ZTY1YTRjYzNmNTdhMzA5Y2U5MjliM2I3YTZhOTgzZjZmYzI3OWU=
|
@@ -25,9 +25,11 @@ Caboose.Store.Modules.Product = (function() {
|
|
25
25
|
self.option2_values = response.option2_values;
|
26
26
|
self.option3_values = response.option3_values;
|
27
27
|
self.render();
|
28
|
-
self.bindEvents();
|
28
|
+
self.bindEvents();
|
29
29
|
self.setVariant(self.getInitialVariant());
|
30
|
+
console.log('Test1');
|
30
31
|
self.setOptionsFromVariant(self.variant);
|
32
|
+
console.log('Test2');
|
31
33
|
});
|
32
34
|
};
|
33
35
|
|
@@ -96,9 +98,9 @@ Caboose.Store.Modules.Product = (function() {
|
|
96
98
|
if ($targetValue.hasClass('selected')) {
|
97
99
|
$targetValue.removeClass('selected');
|
98
100
|
$targetValue = $();
|
99
|
-
} else {
|
101
|
+
} else {
|
100
102
|
$targetValue.addClass('selected').siblings().removeClass('selected');
|
101
|
-
|
103
|
+
|
102
104
|
self.$options.find('ul').not($targetOption).each(function(index, element) {
|
103
105
|
var $currentOption = $(element)
|
104
106
|
, $currentValue = $currentOption.children('.selected')
|
@@ -109,8 +111,8 @@ Caboose.Store.Modules.Product = (function() {
|
|
109
111
|
if (!$currentValue.length) return true;
|
110
112
|
|
111
113
|
options.push({ name: $currentOption.data('name'), value: $currentValue.data('value') });
|
112
|
-
options.push({ name: $targetOption.data('name'), value: $targetValue.data('value') });
|
113
|
-
|
114
|
+
options.push({ name: $targetOption.data('name'), value: $targetValue.data('value') });
|
115
|
+
|
114
116
|
if (!!!self.getVariantFromOptions(options)) {
|
115
117
|
$currentValue.removeClass('selected');
|
116
118
|
} else if ($otherOption.length && $otherValue.length) {
|
@@ -165,9 +167,8 @@ Caboose.Store.Modules.Product = (function() {
|
|
165
167
|
self.product.option3 ? self.product.option3 : undefined
|
166
168
|
]);
|
167
169
|
};
|
168
|
-
|
169
|
-
|
170
|
-
self.getOptionsFromVariant = function(variant) {
|
170
|
+
|
171
|
+
self.getOptionsFromVariant = function(variant) {
|
171
172
|
return _.compact([
|
172
173
|
self.product.option1 ? { name: self.product.option1, value: variant.option1 } : undefined,
|
173
174
|
self.product.option2 ? { name: self.product.option2, value: variant.option2 } : undefined,
|
@@ -224,7 +225,7 @@ Caboose.Store.Modules.Product = (function() {
|
|
224
225
|
|
225
226
|
self.getInitialVariant = function () {
|
226
227
|
var variant = _.find(self.product.variants, function(variant) {
|
227
|
-
return variant.quantity_in_stock > 0;
|
228
|
+
return variant.quantity_in_stock > 0 || variant.ignore_quantity != false;
|
228
229
|
});
|
229
230
|
|
230
231
|
if (!variant) {
|
@@ -243,14 +244,16 @@ Caboose.Store.Modules.Product = (function() {
|
|
243
244
|
}));
|
244
245
|
|
245
246
|
var variants = _.sortBy(_.where(self.product.variants, attributes), function(variant) { return variant.price });
|
246
|
-
return _.find(variants, function(variant) {
|
247
|
+
return _.find(variants, function(variant) {
|
248
|
+
return variant.quantity_in_stock > 0 || variant.ignore_quantity != false;
|
249
|
+
});
|
247
250
|
};
|
248
251
|
|
249
|
-
self.setOptionsFromVariant = function(variant) {
|
252
|
+
self.setOptionsFromVariant = function(variant) {
|
250
253
|
if (variant.option1) $('#option1 li[data-value="' + variant.option1 + '"]', self.$options).click();
|
251
|
-
if (variant.
|
252
|
-
if (variant.
|
253
|
-
};
|
254
|
+
if (variant.option2) $('#option2 li[data-value="' + variant.option2 + '"]', self.$options).click();
|
255
|
+
if (variant.option3) $('#option3 li[data-value="' + variant.option3 + '"]', self.$options).click();
|
256
|
+
};
|
254
257
|
|
255
258
|
self.setVariant = function(variant) {
|
256
259
|
self.variant = variant;
|
@@ -1,7 +1,6 @@
|
|
1
1
|
<!--<% _.each(options, function(option, index) { %>
|
2
2
|
<select id="<%= 'option' + (index + 1) %>" name="<%= option.name %>">
|
3
|
-
<option value="">Choose an Option</option>
|
4
|
-
|
3
|
+
<option value="">Choose an Option</option>
|
5
4
|
<% _.each(option.values, function(value) { %>
|
6
5
|
<option value="<%= value %>"><%= value %></option>
|
7
6
|
<% }); %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caboose-store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.43
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Barry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: caboose-cms
|