spree_frontend 3.4.6 → 3.5.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +5 -5
  2. data/app/assets/images/credit_cards/icons/jcb.png +0 -0
  3. data/app/assets/javascripts/spree/frontend/cart.js.coffee +1 -1
  4. data/app/assets/javascripts/spree/frontend/checkout/payment.js.coffee +1 -1
  5. data/app/assets/javascripts/spree/frontend/product.js +75 -0
  6. data/app/assets/stylesheets/spree/frontend/frontend_bootstrap.css.scss +8 -1
  7. data/app/controllers/spree/checkout_controller.rb +0 -1
  8. data/app/controllers/spree/content_controller.rb +3 -28
  9. data/app/controllers/spree/orders_controller.rb +0 -1
  10. data/app/controllers/spree/products_controller.rb +0 -1
  11. data/app/controllers/spree/taxons_controller.rb +0 -1
  12. data/app/helpers/spree/frontend_helper.rb +9 -1
  13. data/app/views/spree/checkout/_payment.html.erb +1 -1
  14. data/app/views/spree/checkout/edit.html.erb +0 -7
  15. data/app/views/spree/layouts/spree_application.html.erb +1 -3
  16. data/app/views/spree/orders/edit.html.erb +0 -8
  17. data/app/views/spree/orders/show.html.erb +0 -9
  18. data/app/views/spree/products/_product.html.erb +1 -1
  19. data/app/views/spree/products/show.html.erb +0 -4
  20. data/app/views/spree/shared/_products.html.erb +0 -6
  21. data/app/views/spree/taxons/show.html.erb +0 -5
  22. data/config/routes.rb +1 -1
  23. metadata +12 -24
  24. data/app/assets/javascripts/spree/frontend/product.js.coffee +0 -54
  25. data/app/helpers/spree/trackers_helper.rb +0 -18
  26. data/app/views/spree/shared/_google_add_items.js.erb +0 -11
  27. data/app/views/spree/shared/_google_analytics.js.erb +0 -18
  28. data/app/views/spree/shared/_google_checkout.js.erb +0 -10
  29. data/app/views/spree/shared/_google_purchase.js.erb +0 -13
  30. data/app/views/spree/shared/trackers/segment/_cart_viewed.js.erb +0 -12
  31. data/app/views/spree/shared/trackers/segment/_checkout_step_viewed.js.erb +0 -8
  32. data/app/views/spree/shared/trackers/segment/_initializer.js.erb +0 -8
  33. data/app/views/spree/shared/trackers/segment/_order_complete.js.erb +0 -24
  34. data/app/views/spree/shared/trackers/segment/_product_added.js.erb +0 -5
  35. data/app/views/spree/shared/trackers/segment/_product_list_filtered.js.erb +0 -16
  36. data/app/views/spree/shared/trackers/segment/_product_list_viewed.js.erb +0 -12
  37. data/app/views/spree/shared/trackers/segment/_product_viewed.js.erb +0 -5
  38. data/app/views/spree/shared/trackers/segment/_products_searched.js.erb +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 520fc85d69f6d2423f490f17f1e398863c043ec5e136cb44ff926462572086ce
4
- data.tar.gz: 40713739c7093f669a238493ad10d8c27b446c6e13ae9b7665d5ab5420a283a7
2
+ SHA1:
3
+ metadata.gz: d69f005170eed1f41fcf00bb878c4320cf3a2be0
4
+ data.tar.gz: 911ea2fe68f6c24efa01664f722b0ac178835edc
5
5
  SHA512:
6
- metadata.gz: cdf417e904f885d0eef75666794c20a2d5b3b29b97e1d6cf2b9ee20e90ca1a37f28065c253474b426346a24e033d6af54342e644add0717b1661f44334e2055d
7
- data.tar.gz: 36f7714a6fba25642ed5c4b2c8de07aa37568a508a54609c3ce727ab5e6e5b67dd4c18408bda40592e0b1b9bb5804871437fd8dd9145b3484b22fd2ea1ccfe3d
6
+ metadata.gz: 7bac9eb68fa0a1e5eb3d518658fc250d2d76af3450893ff7ecc096eca0696c28dfa7e8329c9fbdf6e0cdb1644c82cca89447fd4a64c0a00a7b30bd2910eb0f06
7
+ data.tar.gz: b0af5d6e4e9462bf811b07f9358e2d4b87cce827ee8c3b6ae9db5aa564fec9ad3c4bfa83860f9918d8e1484947099022bef4064a0d7dc6de9fdfd8fdf9d82d61
@@ -12,7 +12,7 @@ Spree.ready ($) ->
12
12
  input =
13
13
  couponCodeField: $('#order_coupon_code')
14
14
  couponStatus: $('#coupon_status')
15
- if input.couponCodeField.val().trim().length > 0
15
+ if $.trim(input.couponCodeField.val()).length > 0
16
16
  if new CouponManager(input).applyCoupon()
17
17
  @submit()
18
18
  return true
@@ -45,7 +45,7 @@ Spree.ready ($) ->
45
45
  input =
46
46
  couponCodeField: $('#order_coupon_code')
47
47
  couponStatus: $('#coupon_status')
48
- if input.couponCodeField.val().trim().length > 0
48
+ if $.trim(input.couponCodeField.val()).length > 0
49
49
  if new CouponManager(input).applyCoupon()
50
50
  @submit()
51
51
  return true
@@ -0,0 +1,75 @@
1
+ Spree.ready(function ($) {
2
+
3
+ Spree.addImageHandlers = function () {
4
+ var thumbnails = $("#product-images ul.thumbnails");
5
+ ($("#main-image")).data("selectedThumb", ($("#main-image img")).attr("src"));
6
+ thumbnails.find("li").eq(0).addClass("selected");
7
+
8
+ thumbnails.find("a").on("click", function (event) {
9
+ ($("#main-image")).data("selectedThumb", ($(event.currentTarget)).attr("href"));
10
+ ($("#main-image")).data("selectedThumbId", ($(event.currentTarget)).parent().attr("id"));
11
+ thumbnails.find("li").removeClass("selected");
12
+ ($(event.currentTarget)).parent("li").addClass("selected");
13
+ return false;
14
+ });
15
+
16
+ thumbnails.find("li").on("mouseenter", function (event) {
17
+ return ($("#main-image img")).attr("src", ($(event.currentTarget)).find("a").attr("href"));
18
+ });
19
+
20
+ return thumbnails.find("li").on("mouseleave", function (event) {
21
+ return ($("#main-image img")).attr("src", ($("#main-image")).data("selectedThumb"));
22
+ });
23
+ };
24
+
25
+ Spree.showVariantImages = function (variantId) {
26
+ ($("li.vtmb")).hide();
27
+ ($("li.tmb-" + variantId)).show();
28
+ var currentThumb = $("#" + ($("#main-image")).data("selectedThumbId"));
29
+
30
+ if (!currentThumb.hasClass("vtmb + variantId")) {
31
+ var thumb = $(($("#product-images ul.thumbnails li:visible.vtmb")).eq(0));
32
+
33
+ if (!(thumb.length > 0)) {
34
+ thumb = $(($("#product-images ul.thumbnails li:visible")).eq(0));
35
+ }
36
+
37
+ var newImg = thumb.find("a").attr("href");
38
+ ($("#product-images ul.thumbnails li")).removeClass("selected");
39
+ thumb.addClass("selected");
40
+ ($("#main-image img")).attr("src", newImg);
41
+ ($("#main-image")).data("selectedThumb", newImg);
42
+ return ($("#main-image")).data("selectedThumbId", thumb.attr("id"));
43
+ }
44
+ };
45
+
46
+ Spree.updateVariantPrice = function (variant) {
47
+ var variantPrice = variant.data("price");
48
+
49
+ if (variantPrice) {
50
+ return ($(".price.selling")).text(variantPrice);
51
+ }
52
+ };
53
+
54
+ Spree.disableCartForm = function (variant) {
55
+ var inStock = variant.data("in-stock");
56
+ return $("#add-to-cart-button").attr("disabled", !inStock);
57
+ };
58
+
59
+ var radios = $("#product-variants input[type='radio']");
60
+
61
+ if (radios.length > 0) {
62
+ var selectedRadio = $("#product-variants input[type='radio'][checked='checked']");
63
+ Spree.showVariantImages(selectedRadio.attr("value"));
64
+ Spree.updateVariantPrice(selectedRadio);
65
+ Spree.disableCartForm(selectedRadio);
66
+
67
+ radios.click(function (event) {
68
+ Spree.showVariantImages(this.value);
69
+ Spree.updateVariantPrice($(this));
70
+ return Spree.disableCartForm($(this));
71
+ });
72
+ }
73
+
74
+ return Spree.addImageHandlers();
75
+ });
@@ -8,6 +8,7 @@
8
8
  #spree-header {
9
9
  background-color: $brand-primary;
10
10
  margin-bottom: $line-height-computed;
11
+ padding-top: 0.25em;
11
12
 
12
13
  #header {
13
14
  background: rgba($gray-darker, 0.4);
@@ -19,10 +20,16 @@
19
20
 
20
21
  img {
21
22
  max-width: 100%;
22
- max-height: 50px;
23
+ max-height: 5.5vmax;
23
24
  }
24
25
  }
25
26
 
27
+ .navbar-nav > li > a {
28
+ padding-top: 0;
29
+ padding-bottom: 10px;
30
+ line-height: $line-height-computed;
31
+ }
32
+
26
33
  .nav a {
27
34
  color: white;
28
35
 
@@ -4,7 +4,6 @@ module Spree
4
4
  # checkout which has nothing to do with updating an order that this approach
5
5
  # is waranted.
6
6
  class CheckoutController < Spree::StoreController
7
- before_action :expires_now, only: [:edit]
8
7
  before_action :load_order_with_lock
9
8
  before_action :ensure_valid_state_lock_version, only: [:update]
10
9
  before_action :set_state_if_present
@@ -1,43 +1,18 @@
1
1
  module Spree
2
2
  class ContentController < Spree::StoreController
3
3
  # Don't serve local files or static assets
4
- before_action { render_404 if params[:path] =~ /(\.|\\)/ }
5
- after_action :fire_visited_path, only: :show
6
-
7
- rescue_from ActionView::MissingTemplate, with: :render_404
4
+ after_action :fire_visited_path, except: :cvv
8
5
 
9
6
  respond_to :html
10
7
 
11
- def show
12
- ActiveSupport::Deprecation.warn(<<-EOS, caller)
13
- ContentController#show is deprecated and will be removed in Spree 3.5
14
- Please don't use dynamic render paths and just declare your actions in
15
- ContentController decorator, eg.
16
-
17
- routes.rb:
18
- get '/content/custom_page', to: 'content#custom_page', as: :custom_page
19
-
20
- controllers/spree/content_controller_decorator.rb:
21
- Spree::ContentController.class_eval do
22
- def custom_page
23
- end
24
- end
25
-
26
- change links from:
27
- spree.content_path('custom_page')
28
-
29
- to:
30
- spree.custom_page
31
- EOS
32
- render action: params[:path]
33
- end
8
+ def test; end
34
9
 
35
10
  def cvv
36
11
  render layout: false
37
12
  end
38
13
 
39
14
  def fire_visited_path
40
- Spree::PromotionHandler::Page.new(current_order, params[:path]).activate
15
+ Spree::PromotionHandler::Page.new(current_order, params[:action]).activate
41
16
  end
42
17
  end
43
18
  end
@@ -1,7 +1,6 @@
1
1
  module Spree
2
2
  class OrdersController < Spree::StoreController
3
3
  before_action :check_authorization
4
- rescue_from ActiveRecord::RecordNotFound, with: :render_404
5
4
  helper 'spree/products', 'spree/orders'
6
5
 
7
6
  respond_to :html
@@ -3,7 +3,6 @@ module Spree
3
3
  before_action :load_product, only: :show
4
4
  before_action :load_taxon, only: :index
5
5
 
6
- rescue_from ActiveRecord::RecordNotFound, with: :render_404
7
6
  helper 'spree/taxons'
8
7
 
9
8
  respond_to :html
@@ -1,6 +1,5 @@
1
1
  module Spree
2
2
  class TaxonsController < Spree::StoreController
3
- rescue_from ActiveRecord::RecordNotFound, with: :render_404
4
3
  helper 'spree/products'
5
4
 
6
5
  respond_to :html
@@ -5,7 +5,7 @@ module Spree
5
5
  @body_class
6
6
  end
7
7
 
8
- def breadcrumbs(taxon, separator = '&nbsp;')
8
+ def spree_breadcrumbs(taxon, separator = '&nbsp;')
9
9
  return '' if current_page?('/') || taxon.nil?
10
10
  separator = raw(separator)
11
11
  crumbs = [content_tag(:li, content_tag(:span, link_to(content_tag(:span, Spree.t(:home), itemprop: 'name'), spree.root_path, itemprop: 'url') + separator, itemprop: 'item'), itemscope: 'itemscope', itemtype: 'https://schema.org/ListItem', itemprop: 'itemListElement')]
@@ -20,6 +20,14 @@ module Spree
20
20
  content_tag(:nav, crumb_list, id: 'breadcrumbs', class: 'col-md-12')
21
21
  end
22
22
 
23
+ def breadcrumbs(taxon, separator = '&nbsp;')
24
+ ActiveSupport::Deprecation.warn(<<-EOS, caller)
25
+ Spree::FrontendHelper#breadcrumbs was renamed to Spree::FrontendHelper#spree_breadcrumbs
26
+ and will be removed in Spree 3.6. Please update your code to avoid problems after update
27
+ EOS
28
+ spree_breadcrumbs(taxon, separator)
29
+ end
30
+
23
31
  def checkout_progress(numbers: false)
24
32
  states = @order.checkout_steps
25
33
  items = states.each_with_index.map do |state, i|
@@ -39,7 +39,7 @@
39
39
 
40
40
  <ul class="list-group" id="payment-method-fields" data-hook>
41
41
  <% @order.available_payment_methods.each do |method| %>
42
- <li class="list-group-item">
42
+ <li class="list-group-item radio">
43
43
  <label>
44
44
  <%= radio_button_tag "order[payments_attributes][][payment_method_id]", method.id, method == @order.available_payment_methods.first %>
45
45
  <%= Spree.t(method.name, scope: :payment_methods, default: method.name) %>
@@ -1,11 +1,4 @@
1
1
  <% @body_id = 'checkout-page' %>
2
- <% content_for :google_analytics do %>
3
- <%= render partial: 'spree/shared/google_checkout.js', locals: { order: @order, step_number: (@order.checkout_steps.index(@order.state) + 1) } %>
4
- <% end %>
5
-
6
- <%= render partial: 'spree/shared/trackers/segment/checkout_step_viewed.js',
7
- formats: :js,
8
- locals: { order: @order } %>
9
2
 
10
3
  <div id="checkout" data-hook>
11
4
  <%= render partial: 'spree/shared/error_messages', locals: { target: @order } %>
@@ -8,13 +8,11 @@
8
8
  <%= render partial: 'spree/shared/head' %>
9
9
  </head>
10
10
  <body class="<%= body_class %>" id="<%= @body_id || 'default' %>" data-hook="body">
11
- <%= render partial: 'spree/shared/google_analytics.js' %>
12
- <%= render partial: 'spree/shared/trackers/segment/initializer.js' %>
13
11
  <%= render partial: 'spree/shared/header' %>
14
12
 
15
13
  <div class="container">
16
14
  <div class="row" data-hook>
17
- <%= breadcrumbs(@taxon) %>
15
+ <%= spree_breadcrumbs(@taxon) %>
18
16
 
19
17
  <%= render partial: 'spree/shared/sidebar' if content_for? :sidebar %>
20
18
 
@@ -1,13 +1,5 @@
1
1
  <% @body_id = 'cart' %>
2
2
 
3
- <% if @variant %>
4
- <%= render partial: 'spree/shared/trackers/segment/product_added.js',
5
- formats: :js,
6
- locals: { product: @variant.product, order: @order } %>
7
- <% end %>
8
- <%= render partial: 'spree/shared/trackers/segment/cart_viewed.js',
9
- formats: :js,
10
- locals: { order: @order } %>
11
3
  <div data-hook="cart_container">
12
4
  <h1><%= Spree.t(:shopping_cart) %></h1>
13
5
 
@@ -1,12 +1,3 @@
1
- <% if order_just_completed?(@order) %>
2
- <%= render partial: 'spree/shared/trackers/segment/order_complete.js',
3
- formats: :js,
4
- locals: { order: @order } %>
5
- <% content_for :google_analytics do %>
6
- <%= render partial: 'spree/shared/google_purchase.js', locals: { order: @order } %>
7
- <% end %>
8
- <% end %>
9
-
10
1
  <fieldset id="order_summary" data-hook>
11
2
  <h1><%= accurate_title %></h1>
12
3
  <% if order_just_completed?(@order) %>
@@ -11,7 +11,7 @@
11
11
  </div>
12
12
  <div class="panel-footer text-center">
13
13
  <span itemprop="offers" itemscope itemtype="https://schema.org/Offer">
14
- <span class="price selling lead" itemprop="price" content="<%= product.price_in(current_currency).amount.to_d %>">
14
+ <span class="price selling lead" itemprop="price" content="<%= (product.price_in(current_currency).amount.nil?)? 0 : product.price_in(current_currency).amount.to_d %>">
15
15
  <%= display_price(product) %>
16
16
  </span>
17
17
  <span itemprop="priceCurrency" content="<%= current_currency %>"></span>
@@ -1,9 +1,5 @@
1
1
  <% @body_id = 'product-details' %>
2
2
 
3
- <%= render partial: 'spree/shared/trackers/segment/product_viewed.js',
4
- formats: :js,
5
- locals: { product: @product } %>
6
-
7
3
  <% cache cache_key_for_product do %>
8
4
  <div data-hook="product_show" class="row" itemscope itemtype="https://schema.org/Product">
9
5
  <div class="col-md-4 col-sm-5" data-hook="product_left_part">
@@ -10,18 +10,12 @@
10
10
  <%= Spree.t(:no_products_found) %>
11
11
  </div>
12
12
  <% elsif params.key?(:keywords) %>
13
- <%= render partial: 'spree/shared/trackers/segment/products_searched.js',
14
- formats: :js,
15
- locals: { query: params[:keywords] } %>
16
13
  <div data-hook="products_search_results_heading_results_found">
17
14
  <h6 class="search-results-title"><%= Spree.t(:search_results, keywords: h(params[:keywords])) %></h6>
18
15
  </div>
19
16
  <% end %>
20
17
  </div>
21
18
 
22
- <%= render partial: 'spree/shared/trackers/segment/product_list_viewed.js',
23
- formats: :js,
24
- locals: { taxon: @taxon, products: products } %>
25
19
  <% if products.any? %>
26
20
  <div id="products" class="row" data-hook>
27
21
  <%= render partial: 'spree/products/product', collection: products, locals: { taxon: @taxon } %>
@@ -1,10 +1,5 @@
1
1
  <h1 class="taxon-title"><%= @taxon.name %></h1>
2
2
 
3
- <% if params[:search].present? %>
4
- <%= render partial: 'spree/shared/trackers/segment/product_list_filtered.js',
5
- formats: :js,
6
- locals: { search: params[:search], products: @products } %>
7
- <% end %>
8
3
  <% content_for :sidebar do %>
9
4
  <div data-hook="taxon_sidebar_navigation">
10
5
  <%= render partial: 'spree/shared/taxonomies' %>
data/config/routes.rb CHANGED
@@ -25,6 +25,6 @@ Spree::Core::Engine.add_routes do
25
25
 
26
26
  get '/unauthorized', to: 'home#unauthorized', as: :unauthorized
27
27
  get '/content/cvv', to: 'content#cvv', as: :cvv
28
- get '/content/*path', to: 'content#show', as: :content
28
+ get '/content/test', to: 'content#test'
29
29
  get '/cart_link', to: 'store#cart_link', as: :cart_link
30
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_frontend
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.6
4
+ version: 3.5.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-12 00:00:00.000000000 Z
11
+ date: 2018-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree_api
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 3.4.6
19
+ version: 3.5.0.rc1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 3.4.6
26
+ version: 3.5.0.rc1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: spree_core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 3.4.6
33
+ version: 3.5.0.rc1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 3.4.6
40
+ version: 3.5.0.rc1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bootstrap-sass
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -120,6 +120,7 @@ files:
120
120
  - app/assets/images/credit_cards/icons/directdebit.png
121
121
  - app/assets/images/credit_cards/icons/discover.png
122
122
  - app/assets/images/credit_cards/icons/egold.png
123
+ - app/assets/images/credit_cards/icons/jcb.png
123
124
  - app/assets/images/credit_cards/icons/maestro.png
124
125
  - app/assets/images/credit_cards/icons/master.png
125
126
  - app/assets/images/credit_cards/icons/paypal.png
@@ -141,7 +142,7 @@ files:
141
142
  - app/assets/javascripts/spree/frontend/checkout/payment.js.coffee
142
143
  - app/assets/javascripts/spree/frontend/checkout/shipment.js.coffee
143
144
  - app/assets/javascripts/spree/frontend/coupon_manager.js.coffee
144
- - app/assets/javascripts/spree/frontend/product.js.coffee
145
+ - app/assets/javascripts/spree/frontend/product.js
145
146
  - app/assets/stylesheets/spree/frontend.css
146
147
  - app/assets/stylesheets/spree/frontend/_variables.scss
147
148
  - app/assets/stylesheets/spree/frontend/frontend_bootstrap.css.scss
@@ -156,7 +157,6 @@ files:
156
157
  - app/helpers/spree/frontend_helper.rb
157
158
  - app/helpers/spree/orders_helper.rb
158
159
  - app/helpers/spree/taxons_helper.rb
159
- - app/helpers/spree/trackers_helper.rb
160
160
  - app/models/spree/frontend_configuration.rb
161
161
  - app/views/kaminari/twitter-bootstrap-3/_first_page.html.erb
162
162
  - app/views/kaminari/twitter-bootstrap-3/_gap.html.erb
@@ -196,10 +196,6 @@ files:
196
196
  - app/views/spree/shared/_address.html.erb
197
197
  - app/views/spree/shared/_error_messages.html.erb
198
198
  - app/views/spree/shared/_filters.html.erb
199
- - app/views/spree/shared/_google_add_items.js.erb
200
- - app/views/spree/shared/_google_analytics.js.erb
201
- - app/views/spree/shared/_google_checkout.js.erb
202
- - app/views/spree/shared/_google_purchase.js.erb
203
199
  - app/views/spree/shared/_head.html.erb
204
200
  - app/views/spree/shared/_header.html.erb
205
201
  - app/views/spree/shared/_link_to_cart.html.erb
@@ -216,15 +212,6 @@ files:
216
212
  - app/views/spree/shared/_taxonomies.html.erb
217
213
  - app/views/spree/shared/_translations.html.erb
218
214
  - app/views/spree/shared/forbidden.html.erb
219
- - app/views/spree/shared/trackers/segment/_cart_viewed.js.erb
220
- - app/views/spree/shared/trackers/segment/_checkout_step_viewed.js.erb
221
- - app/views/spree/shared/trackers/segment/_initializer.js.erb
222
- - app/views/spree/shared/trackers/segment/_order_complete.js.erb
223
- - app/views/spree/shared/trackers/segment/_product_added.js.erb
224
- - app/views/spree/shared/trackers/segment/_product_list_filtered.js.erb
225
- - app/views/spree/shared/trackers/segment/_product_list_viewed.js.erb
226
- - app/views/spree/shared/trackers/segment/_product_viewed.js.erb
227
- - app/views/spree/shared/trackers/segment/_products_searched.js.erb
228
215
  - app/views/spree/shared/unauthorized.html.erb
229
216
  - app/views/spree/taxons/_taxon.html.erb
230
217
  - app/views/spree/taxons/show.html.erb
@@ -255,12 +242,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
255
242
  version: 2.2.7
256
243
  required_rubygems_version: !ruby/object:Gem::Requirement
257
244
  requirements:
258
- - - ">="
245
+ - - ">"
259
246
  - !ruby/object:Gem::Version
260
- version: '0'
247
+ version: 1.3.1
261
248
  requirements:
262
249
  - none
263
- rubygems_version: 3.0.2
250
+ rubyforge_project:
251
+ rubygems_version: 2.6.14
264
252
  signing_key:
265
253
  specification_version: 4
266
254
  summary: Frontend e-commerce functionality for the Spree project.
@@ -1,54 +0,0 @@
1
- Spree.ready ($) ->
2
- Spree.addImageHandlers = ->
3
- thumbnails = ($ '#product-images ul.thumbnails')
4
- ($ '#main-image').data 'selectedThumb', ($ '#main-image img').attr('src')
5
- thumbnails.find('li').eq(0).addClass 'selected'
6
- thumbnails.find('a').on 'click', (event) ->
7
- ($ '#main-image').data 'selectedThumb', ($ event.currentTarget).attr('href')
8
- ($ '#main-image').data 'selectedThumbId', ($ event.currentTarget).parent().attr('id')
9
- thumbnails.find('li').removeClass 'selected'
10
- ($ event.currentTarget).parent('li').addClass 'selected'
11
- false
12
-
13
- thumbnails.find('li').on 'mouseenter', (event) ->
14
- ($ '#main-image img').attr 'src', ($ event.currentTarget).find('a').attr('href')
15
-
16
- thumbnails.find('li').on 'mouseleave', (event) ->
17
- ($ '#main-image img').attr 'src', ($ '#main-image').data('selectedThumb')
18
-
19
- Spree.showVariantImages = (variantId) ->
20
- ($ 'li.vtmb').hide()
21
- ($ 'li.tmb-' + variantId).show()
22
- currentThumb = ($ '#' + ($ '#main-image').data('selectedThumbId'))
23
- if not currentThumb.hasClass('vtmb-' + variantId)
24
- thumb = ($ ($ '#product-images ul.thumbnails li:visible.vtmb').eq(0))
25
- thumb = ($ ($ '#product-images ul.thumbnails li:visible').eq(0)) unless thumb.length > 0
26
- newImg = thumb.find('a').attr('href')
27
- ($ '#product-images ul.thumbnails li').removeClass 'selected'
28
- thumb.addClass 'selected'
29
- ($ '#main-image img').attr 'src', newImg
30
- ($ '#main-image').data 'selectedThumb', newImg
31
- ($ '#main-image').data 'selectedThumbId', thumb.attr('id')
32
-
33
- Spree.updateVariantPrice = (variant) ->
34
- variantPrice = variant.data('price')
35
- ($ '.price.selling').text(variantPrice) if variantPrice
36
-
37
- Spree.disableCartForm = (variant) ->
38
- inStock = variant.data('in-stock')
39
- $('#add-to-cart-button').attr('disabled', !inStock)
40
-
41
- radios = ($ '#product-variants input[type="radio"]')
42
-
43
- if radios.length > 0
44
- selectedRadio = ($ '#product-variants input[type="radio"][checked="checked"]')
45
- Spree.showVariantImages selectedRadio.attr('value')
46
- Spree.updateVariantPrice selectedRadio
47
- Spree.disableCartForm selectedRadio
48
-
49
- radios.click (event) ->
50
- Spree.showVariantImages @value
51
- Spree.updateVariantPrice ($ this)
52
- Spree.disableCartForm ($ this)
53
-
54
- Spree.addImageHandlers()
@@ -1,18 +0,0 @@
1
- module Spree
2
- module TrackersHelper
3
- def product_for_segment(product, optional = {})
4
- {
5
- product_id: product.id,
6
- sku: product.sku,
7
- category: product.category.try(:name),
8
- name: product.name,
9
- brand: product.brand.try(:name),
10
- price: product.price,
11
- currency: product.currency,
12
- url: product_url(product),
13
- }.tap do |hash|
14
- hash[:image_url] = asset_url(optional.delete(:image).attachment) if optional[:image]
15
- end.merge(optional).to_json.html_safe
16
- end
17
- end
18
- end
@@ -1,11 +0,0 @@
1
- <% order.line_items.each do |line_item| %>
2
- ga('ec:addProduct', { // Provide product details in a productFieldObject.
3
- 'id': '<%= j (line_item.sku.present? ? line_item.sku : line_item.variant_id.to_s) %>', // Product ID (string).
4
- 'name': '<%= j line_item.name %>', // Product name (string).
5
- 'category': '<%= j line_item.category.try(:name) %>', // Product category (string).
6
- 'brand': '<%= j line_item.brand.try(:name) %>', // Product brand (string).
7
- 'variant': '<%= j line_item.options_text %>', // Product variant (string).
8
- 'price': '<%= line_item.price %>',
9
- 'quantity': <%= line_item.quantity %>
10
- });
11
- <% end %>
@@ -1,18 +0,0 @@
1
- <% if tracker = Spree::Tracker.current(:google_analytics) %>
2
- <script>
3
- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
4
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
5
- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
6
- })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
7
-
8
- <% if user_analytics_id = try_spree_current_user.try(:analytics_id) %>
9
- ga('create', { 'trackingId': '<%= tracker.analytics_id %>', 'cookieDomain': 'auto', 'userId': '<%= user_analytics_id %>' });
10
- <% else %>
11
- ga('create', '<%= tracker.analytics_id %>', 'auto');
12
- <% end %>
13
-
14
- ga('require', 'displayfeatures');
15
- <%= yield :google_analytics %>
16
- ga('send', 'pageview');
17
- </script>
18
- <% end %>
@@ -1,10 +0,0 @@
1
- <%# more info: https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce %>
2
- ga('require', 'ec');
3
- ga('set', '&cu', '<%= current_currency %>');
4
-
5
- <%= render partial: 'spree/shared/google_add_items.js', locals: { order: order } %>
6
-
7
- // Add the step number and additional info about the checkout to the action.
8
- ga('ec:setAction','checkout', {
9
- 'step': <%= step_number %>
10
- });
@@ -1,13 +0,0 @@
1
- <%# more info: https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce %>
2
- ga('require', 'ec');
3
- ga('set', '&cu', '<%= current_currency %>');
4
-
5
- <%= render partial: 'spree/shared/google_add_items.js', locals: { order: order } %>
6
-
7
- ga('ec:setAction', 'purchase', { // Transaction details are provided in an actionFieldObject.
8
- 'id': '<%= j order.number %>', // Transaction ID. Required.
9
- 'affiliation': '<%= current_store.name %>', // Affiliation (string).
10
- 'revenue': '<%= order.total %>', // Revenue (currency).
11
- 'tax': '<%= @order.tax_total %>', // Tax.
12
- 'shipping': '<%= @order.ship_total %>' // Shipping.
13
- });
@@ -1,12 +0,0 @@
1
- <script>
2
- if (typeof analytics !== 'undefined') {
3
- analytics.track('Cart Viewed', {
4
- cart_id: '<%= order.number %>',
5
- products: [
6
- <% order.line_items.each_with_index do |line_item, index| %>
7
- <%= product_for_segment(line_item, position: index+1, quantity: line_item.quantity) %>,
8
- <% end %>
9
- ]
10
- });
11
- }
12
- </script>
@@ -1,8 +0,0 @@
1
- <script>
2
- if (typeof analytics !== 'undefined') {
3
- analytics.track('Checkout Step Viewed', {
4
- checkout_id: '<%= order.number %>',
5
- step: '<%= (order.checkout_steps.index(order.state) + 1) %>'
6
- });
7
- }
8
- </script>
@@ -1,8 +0,0 @@
1
- <% if tracker = Spree::Tracker.current(:segment) %>
2
- <script>
3
- !function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","page","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t<analytics.methods.length;t++){var e=analytics.methods[t];analytics[e]=analytics.factory(e)}analytics.load=function(t){var e=document.createElement("script");e.type="text/javascript";e.async=!0;e.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.com/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(e,n)};analytics.SNIPPET_VERSION="3.1.0";
4
- analytics.load('<%= tracker.analytics_id %>');
5
- analytics.page()
6
- }}();
7
- </script>
8
- <% end %>
@@ -1,24 +0,0 @@
1
- <script>
2
- if (typeof analytics !== 'undefined') {
3
- analytics.track('Order Completed', {
4
- order_id: '<%= order.number %>',
5
- total: '<%= order.total %>',
6
- shipping: '<%= order.shipment_total %>',
7
- tax: '<%= order.additional_tax_total %>',
8
- discount: '<%= order.promo_total %>',
9
- coupon: '<%= order.promo_code %>',
10
- currency: '<%= order.currency %>',
11
- products: [
12
- <% order.line_items.each do |line_item| %>
13
- {
14
- product_id: '<%= line_item.product.id %>',
15
- sku: '<%= line_item.variant.sku %>',
16
- name: '<%= line_item.product.name %>',
17
- price: '<%= line_item.price %>',
18
- quantity: '<%= line_item.quantity %>'
19
- },
20
- <% end %>
21
- ]
22
- });
23
- }
24
- </script>
@@ -1,5 +0,0 @@
1
- <script>
2
- if (typeof analytics !== 'undefined') {
3
- analytics.track('Product Added', product_for_segment(variant.product, cart_id: order.number);
4
- }
5
- </script>
@@ -1,16 +0,0 @@
1
- <script>
2
- if (typeof analytics !== 'undefined') {
3
- analytics.track('Product List Filtered', {
4
- filters: [
5
- <% search.to_unsafe_h.each do |type, value| %>
6
- <%= { type: type, value: value } .to_json.html_safe %>,
7
- <% end %>
8
- ],
9
- products: [
10
- <% products.each_with_index do |product, index| %>
11
- <%= product_for_segment(product, position: index+1, image: product.images.first) %>,
12
- <% end %>
13
- ]
14
- });
15
- }
16
- </script>
@@ -1,12 +0,0 @@
1
- <script>
2
- if (typeof analytics !== 'undefined') {
3
- analytics.track('Product List Viewed', {
4
- category: '<%= taxon.try(:name) %>',
5
- products: [
6
- <% products.each_with_index do |product, index| %>
7
- <%= product_for_segment(product, position: index+1, image: product.images.first) %>,
8
- <% end %>
9
- ]
10
- });
11
- }
12
- </script>
@@ -1,5 +0,0 @@
1
- <script>
2
- if (typeof analytics !== 'undefined') {
3
- analytics.track('Product Viewed', <%= product_for_segment(product, image: product.images.first) %>);
4
- }
5
- </script>
@@ -1,7 +0,0 @@
1
- <script>
2
- if (typeof analytics !== 'undefined') {
3
- analytics.track('Products Searched', {
4
- query: '<%= query %>',
5
- });
6
- }
7
- </script>