solidus_frontend 2.4.2 → 2.5.0.beta1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of solidus_frontend might be problematic. Click here for more details.

Files changed (132) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +1 -5
  3. data/Rakefile +7 -7
  4. data/app/assets/config/solidus_frontend_manifest.js +0 -2
  5. data/app/assets/javascripts/spree/frontend.js +0 -1
  6. data/app/assets/javascripts/spree/frontend/cart.js +30 -0
  7. data/app/assets/javascripts/spree/frontend/checkout.js +24 -0
  8. data/app/assets/javascripts/spree/frontend/checkout/address.js +128 -0
  9. data/app/assets/javascripts/spree/frontend/checkout/coupon-code.js +40 -0
  10. data/app/assets/javascripts/spree/frontend/checkout/payment.js +55 -0
  11. data/app/assets/javascripts/spree/frontend/product.js +81 -0
  12. data/app/assets/stylesheets/spree/frontend/_variables.scss +3 -0
  13. data/app/assets/stylesheets/spree/frontend/screen.css.scss +2 -2
  14. data/app/controllers/spree/checkout_controller.rb +3 -3
  15. data/app/controllers/spree/locale_controller.rb +2 -2
  16. data/app/controllers/spree/orders_controller.rb +5 -6
  17. data/app/controllers/spree/products_controller.rb +0 -1
  18. data/app/controllers/spree/store_controller.rb +1 -1
  19. data/app/controllers/spree/taxons_controller.rb +0 -1
  20. data/app/views/spree/address/_form.html.erb +23 -21
  21. data/app/views/spree/checkout/_address.html.erb +5 -5
  22. data/app/views/spree/checkout/_confirm.html.erb +3 -3
  23. data/app/views/spree/checkout/_delivery.html.erb +18 -14
  24. data/app/views/spree/checkout/_payment.html.erb +6 -6
  25. data/app/views/spree/checkout/_summary.html.erb +5 -5
  26. data/app/views/spree/checkout/edit.html.erb +2 -6
  27. data/app/views/spree/checkout/payment/_gateway.html.erb +9 -9
  28. data/app/views/spree/content/cvv.html.erb +1 -1
  29. data/app/views/spree/orders/_adjustments.html.erb +4 -4
  30. data/app/views/spree/orders/_form.html.erb +6 -6
  31. data/app/views/spree/orders/_line_item.html.erb +4 -4
  32. data/app/views/spree/orders/edit.html.erb +9 -9
  33. data/app/views/spree/orders/show.html.erb +4 -4
  34. data/app/views/spree/payments/_payment.html.erb +1 -1
  35. data/app/views/spree/products/_cart_form.html.erb +7 -7
  36. data/app/views/spree/products/_image.html.erb +2 -2
  37. data/app/views/spree/products/_promotions.html.erb +1 -1
  38. data/app/views/spree/products/_properties.html.erb +1 -1
  39. data/app/views/spree/products/_taxons.html.erb +1 -1
  40. data/app/views/spree/products/index.html.erb +1 -1
  41. data/app/views/spree/products/show.html.erb +1 -1
  42. data/app/views/spree/shared/_address.html.erb +2 -2
  43. data/app/views/spree/shared/_filters.html.erb +2 -2
  44. data/app/views/spree/shared/_footer.html.erb +1 -1
  45. data/app/views/spree/shared/_image.html.erb +12 -0
  46. data/app/views/spree/shared/_login_bar_items.html.erb +1 -0
  47. data/app/views/spree/shared/_main_nav_bar.html.erb +2 -2
  48. data/app/views/spree/shared/_nav_bar.html.erb +1 -0
  49. data/app/views/spree/shared/_order_details.html.erb +20 -20
  50. data/app/views/spree/shared/_products.html.erb +3 -3
  51. data/app/views/spree/shared/_search.html.erb +3 -3
  52. data/app/views/spree/shared/_shipment_tracking.html.erb +1 -1
  53. data/app/views/spree/shared/_taxonomies.html.erb +2 -2
  54. data/lib/generators/solidus/views/override_generator.rb +1 -0
  55. data/lib/spree/frontend.rb +4 -2
  56. data/solidus_frontend.gemspec +1 -2
  57. data/spec/controllers/spree/checkout_controller_spec.rb +12 -12
  58. data/spec/controllers/spree/current_order_tracking_spec.rb +1 -1
  59. data/spec/controllers/spree/orders_controller_ability_spec.rb +6 -4
  60. data/spec/controllers/spree/orders_controller_spec.rb +4 -3
  61. data/spec/controllers/spree/orders_controller_transitions_spec.rb +1 -1
  62. data/spec/controllers/spree/products_controller_spec.rb +3 -2
  63. data/spec/features/caching/products_spec.rb +7 -7
  64. data/spec/features/cart_spec.rb +1 -1
  65. data/spec/features/checkout_spec.rb +10 -9
  66. data/spec/features/coupon_code_spec.rb +12 -13
  67. data/spec/features/locale_spec.rb +0 -38
  68. data/spec/features/order_spec.rb +1 -1
  69. data/spec/features/products_spec.rb +4 -4
  70. data/spec/features/promotion_code_invalidation_spec.rb +3 -3
  71. data/spec/features/quantity_promotions_spec.rb +5 -5
  72. data/spec/generators/solidus/views/override_generator_spec.rb +2 -1
  73. data/spec/spec_helper.rb +19 -41
  74. data/spec/support/shared_contexts/custom_products.rb +17 -17
  75. metadata +19 -88
  76. data/Gemfile +0 -7
  77. data/app/assets/javascripts/spree/frontend/cart.js.coffee +0 -15
  78. data/app/assets/javascripts/spree/frontend/checkout.js.coffee +0 -17
  79. data/app/assets/javascripts/spree/frontend/checkout/address.js.coffee +0 -91
  80. data/app/assets/javascripts/spree/frontend/checkout/coupon-code.js.coffee +0 -34
  81. data/app/assets/javascripts/spree/frontend/checkout/payment.js.coffee +0 -42
  82. data/app/assets/javascripts/spree/frontend/product.js.coffee +0 -47
  83. data/vendor/assets/javascripts/jquery.validate/additional-methods.min.js +0 -12
  84. data/vendor/assets/javascripts/jquery.validate/jquery.validate.min.js +0 -12
  85. data/vendor/assets/javascripts/jquery.validate/localization/messages_ar.js +0 -25
  86. data/vendor/assets/javascripts/jquery.validate/localization/messages_bg.js +0 -25
  87. data/vendor/assets/javascripts/jquery.validate/localization/messages_ca.js +0 -25
  88. data/vendor/assets/javascripts/jquery.validate/localization/messages_cs.js +0 -25
  89. data/vendor/assets/javascripts/jquery.validate/localization/messages_da.js +0 -22
  90. data/vendor/assets/javascripts/jquery.validate/localization/messages_de.js +0 -22
  91. data/vendor/assets/javascripts/jquery.validate/localization/messages_el.js +0 -25
  92. data/vendor/assets/javascripts/jquery.validate/localization/messages_es.js +0 -25
  93. data/vendor/assets/javascripts/jquery.validate/localization/messages_et.js +0 -23
  94. data/vendor/assets/javascripts/jquery.validate/localization/messages_eu.js +0 -25
  95. data/vendor/assets/javascripts/jquery.validate/localization/messages_fa.js +0 -25
  96. data/vendor/assets/javascripts/jquery.validate/localization/messages_fi.js +0 -23
  97. data/vendor/assets/javascripts/jquery.validate/localization/messages_fr.js +0 -47
  98. data/vendor/assets/javascripts/jquery.validate/localization/messages_ge.js +0 -23
  99. data/vendor/assets/javascripts/jquery.validate/localization/messages_he.js +0 -25
  100. data/vendor/assets/javascripts/jquery.validate/localization/messages_hr.js +0 -25
  101. data/vendor/assets/javascripts/jquery.validate/localization/messages_hu.js +0 -24
  102. data/vendor/assets/javascripts/jquery.validate/localization/messages_it.js +0 -25
  103. data/vendor/assets/javascripts/jquery.validate/localization/messages_ja.js +0 -25
  104. data/vendor/assets/javascripts/jquery.validate/localization/messages_ka.js +0 -25
  105. data/vendor/assets/javascripts/jquery.validate/localization/messages_kk.js +0 -25
  106. data/vendor/assets/javascripts/jquery.validate/localization/messages_ko.js +0 -25
  107. data/vendor/assets/javascripts/jquery.validate/localization/messages_lt.js +0 -25
  108. data/vendor/assets/javascripts/jquery.validate/localization/messages_lv.js +0 -25
  109. data/vendor/assets/javascripts/jquery.validate/localization/messages_ms.js +0 -25
  110. data/vendor/assets/javascripts/jquery.validate/localization/messages_nl.js +0 -35
  111. data/vendor/assets/javascripts/jquery.validate/localization/messages_no.js +0 -25
  112. data/vendor/assets/javascripts/jquery.validate/localization/messages_pl.js +0 -25
  113. data/vendor/assets/javascripts/jquery.validate/localization/messages_ptbr.js +0 -24
  114. data/vendor/assets/javascripts/jquery.validate/localization/messages_ptpt.js +0 -24
  115. data/vendor/assets/javascripts/jquery.validate/localization/messages_ro.js +0 -25
  116. data/vendor/assets/javascripts/jquery.validate/localization/messages_ru.js +0 -25
  117. data/vendor/assets/javascripts/jquery.validate/localization/messages_se.js +0 -23
  118. data/vendor/assets/javascripts/jquery.validate/localization/messages_si.js +0 -25
  119. data/vendor/assets/javascripts/jquery.validate/localization/messages_sk.js +0 -22
  120. data/vendor/assets/javascripts/jquery.validate/localization/messages_sl.js +0 -25
  121. data/vendor/assets/javascripts/jquery.validate/localization/messages_sr.js +0 -25
  122. data/vendor/assets/javascripts/jquery.validate/localization/messages_sv.js +0 -23
  123. data/vendor/assets/javascripts/jquery.validate/localization/messages_th.js +0 -25
  124. data/vendor/assets/javascripts/jquery.validate/localization/messages_tr.js +0 -25
  125. data/vendor/assets/javascripts/jquery.validate/localization/messages_tw.js +0 -24
  126. data/vendor/assets/javascripts/jquery.validate/localization/messages_uk.js +0 -25
  127. data/vendor/assets/javascripts/jquery.validate/localization/messages_vi.js +0 -25
  128. data/vendor/assets/javascripts/jquery.validate/localization/messages_zh.js +0 -25
  129. data/vendor/assets/javascripts/jquery.validate/localization/messages_zhtw.js +0 -26
  130. data/vendor/assets/javascripts/jquery.validate/localization/methods_de.js +0 -12
  131. data/vendor/assets/javascripts/jquery.validate/localization/methods_nl.js +0 -9
  132. data/vendor/assets/javascripts/jquery.validate/localization/methods_pt.js +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 73be2a8aa02def25a64616ccc35fede421c5e42d
4
- data.tar.gz: 35f818ac5ac2bb6ed2ef5cc0186d41d43f87f4bb
2
+ SHA256:
3
+ metadata.gz: 58ad7ed80ff2185d5baf51172670cb55fb1fe000f9e352cca2d80a4798833dc8
4
+ data.tar.gz: ab46d690e2f6c0e7c7a47620993fcbec2abb40648b7bb94989bd2d8b5dae397b
5
5
  SHA512:
6
- metadata.gz: c2ce4b9f973c40607e3547496ba3ae4f0153505c9edab64993364a05c8135004d909d4e5baa2d8a11903b3d871dfe50bc33e33d3464a3e021f0facfbad65689a
7
- data.tar.gz: 86833b7f2ff5abff4355e4692bf87438488881bbb468c7a44dbabef6a9242a7f3d1f7be9b3e0a11f94a870a1053e4d780fefea31bcc420a6ba744a828e788298
6
+ metadata.gz: 343f2b7d5d1e50a118b8bd2d2fcdf6a1ae5a6c051ae37cc82ecb786614303d4370e47ff09871305c5a34273f587a5a393e5572a55ac03ea6790e7c638fba6523
7
+ data.tar.gz: ca76f865a432929dad0df2c607bfa6025320fb5be102ff539bdae33a22731ec62266caebe66c522582fcaf33c58e9201e8b8a23e265dc0903dc5e2bb6bc5ba1a
data/README.md CHANGED
@@ -35,10 +35,6 @@ After upgrading solidus to a new version run the generator again and follow on s
35
35
 
36
36
  ## Testing
37
37
 
38
- Create the test site
39
-
40
- bundle exec rake test_app
41
-
42
38
  Run the tests
43
39
 
44
- bundle exec rake spec
40
+ bundle exec rspec
data/Rakefile CHANGED
@@ -2,14 +2,14 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'rake/testtask'
4
4
  require 'rspec/core/rake_task'
5
- require 'spree/testing_support/common_rake'
5
+ require 'spree/testing_support/dummy_app/rake_tasks'
6
6
 
7
7
  RSpec::Core::RakeTask.new
8
-
9
8
  task default: :spec
10
9
 
11
- desc "Generates a dummy app for testing"
12
- task :test_app do
13
- ENV['LIB_NAME'] = 'spree/frontend'
14
- Rake::Task['common:test_app'].invoke
15
- end
10
+ DummyApp::RakeTasks.new(
11
+ gem_root: File.expand_path('../', __FILE__),
12
+ lib_name: 'solidus_frontend'
13
+ )
14
+
15
+ task test_app: 'db:reset'
@@ -1,5 +1,3 @@
1
- //= link_tree ../../../vendor/assets/javascripts/jquery.validate/localization/ .js
2
- //
3
1
  //= link_tree ../images
4
2
  //
5
3
  //= link spree/frontend/all.js
@@ -1,4 +1,3 @@
1
- //= require jquery.validate/jquery.validate.min
2
1
  //= require spree
3
2
  //= require spree/frontend/checkout
4
3
  //= require spree/frontend/product
@@ -0,0 +1,30 @@
1
+ Spree.ready(function($) {
2
+ if ($("form#update-cart").is("*")) {
3
+ $("form#update-cart a.delete")
4
+ .show()
5
+ .one("click", function() {
6
+ $(this)
7
+ .parents(".line-item")
8
+ .first()
9
+ .find("input.line_item_quantity")
10
+ .val(0);
11
+ $(this)
12
+ .parents("form")
13
+ .first()
14
+ .submit();
15
+ return false;
16
+ });
17
+ }
18
+ $("form#update-cart").submit(function() {
19
+ $("form#update-cart #update-button").attr("disabled", true);
20
+ });
21
+ });
22
+
23
+ Spree.fetch_cart = function(cartLinkUrl) {
24
+ Spree.ajax({
25
+ url: cartLinkUrl || Spree.pathFor("cart_link"),
26
+ success: function(data) {
27
+ $("#link-to-cart").html(data);
28
+ }
29
+ });
30
+ };
@@ -0,0 +1,24 @@
1
+ //= require jquery.payment
2
+ //= require_self
3
+ //= require spree/frontend/checkout/address
4
+ //= require spree/frontend/checkout/payment
5
+ //= require spree/frontend/checkout/coupon-code
6
+
7
+ Spree.disableSaveOnClick = function() {
8
+ $("form.edit_order").submit(function() {
9
+ $(this)
10
+ .find(":submit, :image")
11
+ .attr("disabled", true)
12
+ .removeClass("primary")
13
+ .addClass("disabled");
14
+ });
15
+ };
16
+
17
+ Spree.ready(function($) {
18
+ var termsCheckbox = $("#accept_terms_and_conditions");
19
+ termsCheckbox.change(function() {
20
+ var submitBtn = $(this.closest("form")).find(":submit");
21
+ submitBtn.prop("disabled", !this.checked);
22
+ submitBtn.toggleClass("disabled", !this.checked);
23
+ });
24
+ });
@@ -0,0 +1,128 @@
1
+ Spree.ready(function($) {
2
+ if ($("#checkout_form_address").is("*")) {
3
+ // Hidden by default to support browsers with javascript disabled
4
+ $(".js-address-fields").show();
5
+
6
+ var getCountryId = function(region) {
7
+ return $("#" + region + "country select").val();
8
+ };
9
+
10
+ var statesByCountry = {};
11
+
12
+ var updateState = function(region) {
13
+ var countryId = getCountryId(region);
14
+ if (countryId != null) {
15
+ if (statesByCountry[countryId] == null) {
16
+ $.get(
17
+ Spree.routes.states_search,
18
+ {
19
+ country_id: countryId
20
+ },
21
+ function(data) {
22
+ statesByCountry[countryId] = {
23
+ states: data.states,
24
+ states_required: data.states_required
25
+ };
26
+ fillStates(region);
27
+ }
28
+ );
29
+ } else {
30
+ fillStates(region);
31
+ }
32
+ }
33
+ };
34
+
35
+ var fillStates = function(region) {
36
+ var countryId = getCountryId(region);
37
+ var data = statesByCountry[countryId];
38
+ if (data == null) {
39
+ return;
40
+ }
41
+ var statesRequired = data.states_required;
42
+ var states = data.states;
43
+ var statePara = $("#" + region + "state");
44
+ var stateSelect = statePara.find("select");
45
+ var stateInput = statePara.find("input");
46
+ var stateSpanRequired = statePara.find('[id$="state-required"]');
47
+ if (states.length > 0) {
48
+ var selected = parseInt(stateSelect.val());
49
+ stateSelect.html("");
50
+ var statesWithBlank = [
51
+ {
52
+ name: "",
53
+ id: ""
54
+ }
55
+ ].concat(states);
56
+ $.each(statesWithBlank, function(idx, state) {
57
+ var opt;
58
+ opt = $(document.createElement("option"))
59
+ .attr("value", state.id)
60
+ .html(state.name);
61
+ if (selected === state.id) {
62
+ opt.prop("selected", true);
63
+ }
64
+ stateSelect.append(opt);
65
+ });
66
+ stateSelect.prop("disabled", false).show();
67
+ stateInput.hide().prop("disabled", true);
68
+ statePara.show();
69
+ if (statesRequired) {
70
+ stateSelect.addClass("required");
71
+ stateSpanRequired.show();
72
+ } else {
73
+ stateSelect.removeClass("required");
74
+ stateSpanRequired.hide();
75
+ }
76
+ stateInput.removeClass("required");
77
+ } else {
78
+ stateSelect.hide().prop("disabled", true);
79
+ stateInput.show();
80
+ if (statesRequired) {
81
+ stateSpanRequired.show();
82
+ stateInput.addClass("required");
83
+ } else {
84
+ stateInput.val("");
85
+ stateSpanRequired.hide();
86
+ stateInput.removeClass("required");
87
+ }
88
+ statePara.toggle(!!statesRequired);
89
+ stateInput.prop("disabled", !statesRequired);
90
+ stateSelect.removeClass("required");
91
+ }
92
+ };
93
+
94
+ $("#bcountry select").change(function() {
95
+ updateState("b");
96
+ });
97
+
98
+ $("#scountry select").change(function() {
99
+ updateState("s");
100
+ });
101
+
102
+ updateState("b");
103
+
104
+ var order_use_billing = $("input#order_use_billing");
105
+ order_use_billing.change(function() {
106
+ update_shipping_form_state(order_use_billing);
107
+ });
108
+
109
+ var update_shipping_form_state = function(order_use_billing) {
110
+ if (order_use_billing.is(":checked")) {
111
+ $("#shipping .inner").hide();
112
+ $("#shipping .inner input, #shipping .inner select").prop(
113
+ "disabled",
114
+ true
115
+ );
116
+ } else {
117
+ $("#shipping .inner").show();
118
+ $("#shipping .inner input, #shipping .inner select").prop(
119
+ "disabled",
120
+ false
121
+ );
122
+ updateState("s");
123
+ }
124
+ };
125
+
126
+ update_shipping_form_state(order_use_billing);
127
+ }
128
+ });
@@ -0,0 +1,40 @@
1
+ Spree.onCouponCodeApply = function(e) {
2
+ var couponCodeField = $("#order_coupon_code");
3
+ var couponCode = $.trim(couponCodeField.val());
4
+ if (couponCode === "") {
5
+ return;
6
+ }
7
+ var couponStatus = $("#coupon_status");
8
+ var successClass = "success";
9
+ var errorClass = "alert";
10
+ couponStatus.removeClass([successClass, errorClass].join(" "));
11
+ var data = {
12
+ order_token: Spree.current_order_token,
13
+ coupon_code: couponCode
14
+ };
15
+ var req = Spree.ajax({
16
+ method: "PUT",
17
+ url: Spree.routes.apply_coupon_code(Spree.current_order_id),
18
+ data: JSON.stringify(data),
19
+ contentType: "application/json"
20
+ });
21
+ req.done(function(data) {
22
+ window.location.reload();
23
+ couponCodeField.val("");
24
+ couponStatus
25
+ .addClass(successClass)
26
+ .html("Coupon code applied successfully.");
27
+ });
28
+ req.fail(function(xhr) {
29
+ var handler;
30
+ // handler = JSON.parse(xhr.responseText)
31
+ handler = xhr.responseJSON;
32
+ couponStatus.addClass(errorClass).html(handler["error"]);
33
+ });
34
+ };
35
+
36
+ Spree.ready(function($) {
37
+ $("#coupon-code-apply-button").click(function(e) {
38
+ Spree.onCouponCodeApply(e);
39
+ });
40
+ });
@@ -0,0 +1,55 @@
1
+ Spree.ready(function($) {
2
+ Spree.onPayment = function() {
3
+ if ($("#checkout_form_payment").is("*")) {
4
+ if ($("#existing_cards").is("*")) {
5
+ $("#payment-method-fields").hide();
6
+ $("#payment-methods").hide();
7
+
8
+ $("#use_existing_card_yes").click(function() {
9
+ $("#payment-method-fields").hide();
10
+ $("#payment-methods").hide();
11
+ $(".existing-cc-radio").prop("disabled", false);
12
+ });
13
+
14
+ $("#use_existing_card_no").click(function() {
15
+ $("#payment-method-fields").show();
16
+ $("#payment-methods").show();
17
+ $(".existing-cc-radio").prop("disabled", true);
18
+ });
19
+ }
20
+
21
+ $(".cardNumber").payment("formatCardNumber");
22
+ $(".cardExpiry").payment("formatCardExpiry");
23
+ $(".cardCode").payment("formatCardCVC");
24
+
25
+ $(".cardNumber").change(function() {
26
+ $(this)
27
+ .parent()
28
+ .siblings(".ccType")
29
+ .val($.payment.cardType(this.value));
30
+ });
31
+
32
+ $(
33
+ 'input[type="radio"][name="order[payments_attributes][][payment_method_id]"]'
34
+ ).click(function() {
35
+ $("#payment-methods li").hide();
36
+ if (this.checked) {
37
+ $("#payment_method_" + this.value).show();
38
+ }
39
+ });
40
+
41
+ $("#cvv_link").on("click", function(event) {
42
+ var windowName = "cvv_info";
43
+ var windowOptions =
44
+ "left=20,top=20,width=500,height=500,toolbar=0,resizable=0,scrollbars=1";
45
+ window.open($(this).attr("href"), windowName, windowOptions);
46
+ event.preventDefault();
47
+ });
48
+
49
+ // Activate already checked payment method if form is re-rendered
50
+ // i.e. if user enters invalid data
51
+ $('input[type="radio"]:checked').click();
52
+ }
53
+ };
54
+ Spree.onPayment();
55
+ });
@@ -0,0 +1,81 @@
1
+ Spree.ready(function($) {
2
+ Spree.addImageHandlers = function() {
3
+ var thumbnails = $("#product-images ul.thumbnails");
4
+ $("#main-image").data("selectedThumb", $("#main-image img").attr("src"));
5
+ if (!thumbnails.find("li.selected").length) {
6
+ thumbnails
7
+ .find("li")
8
+ .eq(0)
9
+ .addClass("selected");
10
+ }
11
+ thumbnails.find("a").on("click", function(event) {
12
+ $("#main-image").data(
13
+ "selectedThumb",
14
+ $(event.currentTarget).attr("href")
15
+ );
16
+ $("#main-image").data(
17
+ "selectedThumbId",
18
+ $(event.currentTarget)
19
+ .parent()
20
+ .attr("id")
21
+ );
22
+ thumbnails.find("li").removeClass("selected");
23
+ $(event.currentTarget)
24
+ .parent("li")
25
+ .addClass("selected");
26
+ return false;
27
+ });
28
+ thumbnails.find("li").on("mouseenter", function(event) {
29
+ $("#main-image img").attr(
30
+ "src",
31
+ $(event.currentTarget)
32
+ .find("a")
33
+ .attr("href")
34
+ );
35
+ });
36
+ thumbnails.find("li").on("mouseleave", function(event) {
37
+ $("#main-image img").attr("src", $("#main-image").data("selectedThumb"));
38
+ });
39
+ };
40
+
41
+ Spree.showVariantImages = function(variantId) {
42
+ $("li.vtmb").hide();
43
+ $("li.tmb-" + variantId).show();
44
+ var currentThumb = $("#" + $("#main-image").data("selectedThumbId"));
45
+ if (!currentThumb.hasClass("vtmb-" + variantId)) {
46
+ var thumb = $($("#product-images ul.thumbnails li:visible.vtmb").eq(0));
47
+ if (!(thumb.length > 0)) {
48
+ thumb = $($("#product-images ul.thumbnails li:visible").eq(0));
49
+ }
50
+ var newImg = thumb.find("a").attr("href");
51
+ $("#product-images ul.thumbnails li").removeClass("selected");
52
+ thumb.addClass("selected");
53
+ $("#main-image img").attr("src", newImg);
54
+ $("#main-image").data("selectedThumb", newImg);
55
+ $("#main-image").data("selectedThumbId", thumb.attr("id"));
56
+ }
57
+ };
58
+
59
+ Spree.updateVariantPrice = function(variant) {
60
+ var variantPrice = variant.data("price");
61
+ if (variantPrice) {
62
+ $(".price.selling").text(variantPrice);
63
+ }
64
+ };
65
+
66
+ var radios = $('#product-variants input[type="radio"]');
67
+ if (radios.length > 0) {
68
+ var selectedRadio = $(
69
+ '#product-variants input[type="radio"][checked="checked"]'
70
+ );
71
+ Spree.showVariantImages(selectedRadio.attr("value"));
72
+ Spree.updateVariantPrice(selectedRadio);
73
+ }
74
+
75
+ Spree.addImageHandlers();
76
+
77
+ radios.click(function(event) {
78
+ Spree.showVariantImages(this.value);
79
+ Spree.updateVariantPrice($(this));
80
+ });
81
+ });
@@ -15,6 +15,9 @@ $product_body_text_color: #404042 !default;
15
15
  $product_price_text_color: #252525 !default;
16
16
  $product_link_text_color: #BBBBBB !default;
17
17
 
18
+ $cart_total_background_color: $link_text_color !default;
19
+ $cart_total_text_color: #FFFFFF !default;
20
+
18
21
  /*--------------------------------------*/
19
22
  /* Fonts import from remote
20
23
  /*--------------------------------------*/
@@ -993,10 +993,10 @@ div[data-hook="inside_cart_form"] {
993
993
  }
994
994
 
995
995
  .cart-subtotal, .cart-total {
996
- background: #00ADEE;
996
+ background: $cart_total_background_color;
997
997
 
998
998
  td h5 {
999
- color: #fff;
999
+ color: $cart_total_text_color;
1000
1000
  }
1001
1001
  }
1002
1002