solidus_subscription_boxes 0.0.12 → 0.0.13
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: 2836da4d5150e9f767ac835fe75739db469ab79d
|
4
|
+
data.tar.gz: e5a1107c69b9de3b7dba8dbf9a9d9f5a15992db1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b70438cc13cbf6df3853ec6489060b5d276a1f0e48c62e3d2e043b7a66e3a5748107ef21aff975ef7262a9359cec5ca803a694123ee4693b44ca871f61029c2
|
7
|
+
data.tar.gz: 55222ea93489ad4efb21fbc5eabc7bd903a12c72ca4503a4b6cc5122ee98410294b75ee708eb8037025ee37ca458a7ce444ce24e6b2683c69108fce932798a60
|
@@ -1,64 +1,82 @@
|
|
1
1
|
// Meal Selection Page
|
2
2
|
function subscriptionFormatDate(date) {
|
3
3
|
var monthNames = [
|
4
|
-
"January",
|
5
|
-
"
|
6
|
-
"
|
7
|
-
"
|
4
|
+
"January",
|
5
|
+
"February",
|
6
|
+
"March",
|
7
|
+
"April",
|
8
|
+
"May",
|
9
|
+
"June",
|
10
|
+
"July",
|
11
|
+
"August",
|
12
|
+
"September",
|
13
|
+
"October",
|
14
|
+
"November",
|
15
|
+
"December"
|
8
16
|
];
|
9
17
|
|
10
18
|
var day = date.getDate();
|
11
19
|
var monthIndex = date.getMonth();
|
12
|
-
|
13
|
-
return monthNames[monthIndex] +
|
20
|
+
|
21
|
+
return monthNames[monthIndex] + " " + day;
|
14
22
|
}
|
15
23
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
+
var setupMealSelection = function() {
|
25
|
+
$(".box-controls i").click(function(event) {
|
26
|
+
var value = parseInt(
|
27
|
+
$(this)
|
28
|
+
.siblings("input")
|
29
|
+
.val()
|
30
|
+
);
|
31
|
+
if (this.classList.contains("add")) {
|
32
|
+
value = Math.min(value + 1, 9);
|
33
|
+
} else {
|
34
|
+
value = Math.max(value - 1, 0);
|
35
|
+
}
|
36
|
+
$(this)
|
37
|
+
.siblings("input")
|
38
|
+
.val(value);
|
24
39
|
|
40
|
+
var numberOfMeals = function() {
|
41
|
+
var total = 0;
|
42
|
+
$(".box-controls input").each(function(element) {
|
43
|
+
total = total + parseInt(this.value);
|
44
|
+
});
|
45
|
+
return total;
|
46
|
+
};
|
25
47
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
}
|
31
|
-
return total;
|
32
|
-
}
|
48
|
+
if ($("body.get_started").length > 0) {
|
49
|
+
var submitButtonText = "Buy Now";
|
50
|
+
} else {
|
51
|
+
var submitButtonText = "Update My Order";
|
52
|
+
}
|
33
53
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
54
|
+
if (numberOfMeals() >= 1) {
|
55
|
+
$("input[type=submit].meal-update").removeAttr("disabled");
|
56
|
+
$("input[type=submit].meal-update").attr("value", submitButtonText);
|
57
|
+
} else {
|
58
|
+
$("input[type=submit].meal-update").attr("disabled", "disabled");
|
59
|
+
$("input[type=submit].meal-update").attr(
|
60
|
+
"value",
|
61
|
+
"Choose " + Math.max(3 - numberOfMeals(), 0).toString() + " More"
|
62
|
+
);
|
63
|
+
}
|
39
64
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
} else {
|
44
|
-
$('input[type=submit].meal-update').attr("disabled","disabled");
|
45
|
-
$('input[type=submit].meal-update').attr("value","Choose " + (Math.max(3 - numberOfMeals(), 0)).toString() + " More");
|
46
|
-
}
|
65
|
+
$(".number_more_meals").text(1 - numberOfMeals());
|
66
|
+
});
|
67
|
+
};
|
47
68
|
|
48
|
-
|
49
|
-
});
|
69
|
+
$(document).on("turbolinks:load", setupMealSelection);
|
50
70
|
|
51
|
-
$(document).ajaxSuccess(function(
|
52
|
-
if(
|
71
|
+
$(document).ajaxSuccess(function(event, xhr, settings) {
|
72
|
+
if (settings.url.match(/\/api\/v1\/subscriptions\/\d*\/skip/)) {
|
53
73
|
var actionableDate = new Date(Date.parse(xhr.responseJSON.actionable_date));
|
54
|
-
$(
|
74
|
+
$(".actionable-date-update").text(subscriptionFormatDate(actionableDate));
|
55
75
|
}
|
56
|
-
if(
|
57
|
-
$(
|
76
|
+
if (settings.url.match(/\/api\/v1\/subscriptions\/\d*\/cancel/)) {
|
77
|
+
$(".manage-subscription").remove();
|
58
78
|
}
|
59
|
-
if(
|
60
|
-
alert("You've updated your subscription.")
|
79
|
+
if (settings.url.match(/\/api\/v1\/subscriptions\/\d*$/)) {
|
80
|
+
alert("You've updated your subscription.");
|
61
81
|
}
|
62
82
|
});
|
63
|
-
|
64
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_subscription_boxes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Jackson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: solidus
|
@@ -211,6 +211,6 @@ signing_key:
|
|
211
211
|
specification_version: 4
|
212
212
|
summary: Add subscription box support to Solidus
|
213
213
|
test_files:
|
214
|
-
- test/integration/navigation_test.rb
|
215
214
|
- test/solidus_subscription_boxes_test.rb
|
215
|
+
- test/integration/navigation_test.rb
|
216
216
|
- test/test_helper.rb
|