solidus_frontend 2.0.3 → 2.1.0.beta1
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.
Potentially problematic release.
This version of solidus_frontend might be problematic. Click here for more details.
- checksums.yaml +4 -4
 - data/app/assets/javascripts/spree/frontend/checkout.js.coffee +0 -3
 - data/app/assets/javascripts/spree/frontend/checkout/address.js.coffee +1 -1
 - data/app/assets/javascripts/spree/frontend/checkout/payment.js.coffee +1 -2
 - data/app/assets/javascripts/spree/frontend/product.js.coffee +2 -2
 - data/app/controllers/spree/checkout_controller.rb +1 -1
 - data/app/controllers/spree/orders_controller.rb +20 -16
 - data/app/views/spree/address/_form.html.erb +26 -13
 - data/app/views/spree/layouts/spree_application.html.erb +0 -1
 - data/app/views/spree/products/_cart_form.html.erb +1 -1
 - data/solidus_frontend.gemspec +4 -1
 - data/spec/controllers/spree/checkout_controller_spec.rb +1 -48
 - data/spec/controllers/spree/orders_controller_spec.rb +13 -1
 - data/spec/features/checkout_spec.rb +3 -3
 - data/spec/features/free_shipping_promotions_spec.rb +8 -9
 - data/spec/features/locale_spec.rb +1 -1
 - metadata +12 -13
 - data/app/views/spree/shared/_google_analytics.html.erb +0 -36
 - data/spec/support/shared_contexts/product_prototypes.rb +0 -28
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 91994caf4d6589e096b79944e9c1b85b4c3471a9
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: '0242813eada0aef5639393066debcd46ced896cb'
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 0345a11808be7289c09ba4224f44bd4dd44f659117883ee775d2f394a52defcf5c95584cbba9505eeb9944504d7ec32508f464c65ddc7496412d1469da5a218c
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: fc78552d2b109388cf8b4924a018b43633ee3ab3a3768e22070f789eebd428cf3d67178a8914a164d9186589a09a9e1831352f51ad8f25c3f4bc6f6399b5609f
         
     | 
| 
         @@ -29,12 +29,11 @@ Spree.ready ($) -> 
     | 
|
| 
       29 
29 
     | 
    
         
             
                    ($ '#payment_method_' + @value).show() if @checked
         
     | 
| 
       30 
30 
     | 
    
         
             
                  )
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
                  ($  
     | 
| 
      
 32 
     | 
    
         
            +
                  ($ '#cvv_link').on 'click', (event) ->
         
     | 
| 
       33 
33 
     | 
    
         
             
                    windowName = 'cvv_info'
         
     | 
| 
       34 
34 
     | 
    
         
             
                    windowOptions = 'left=20,top=20,width=500,height=500,toolbar=0,resizable=0,scrollbars=1'
         
     | 
| 
       35 
35 
     | 
    
         
             
                    window.open(($ this).attr('href'), windowName, windowOptions)
         
     | 
| 
       36 
36 
     | 
    
         
             
                    event.preventDefault()
         
     | 
| 
       37 
     | 
    
         
            -
                  )
         
     | 
| 
       38 
37 
     | 
    
         | 
| 
       39 
38 
     | 
    
         
             
                  # Activate already checked payment method if form is re-rendered
         
     | 
| 
       40 
39 
     | 
    
         
             
                  # i.e. if user enters invalid data
         
     | 
| 
         @@ -1,8 +1,8 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            $ ->
         
     | 
| 
      
 1 
     | 
    
         
            +
            Spree.ready ($) ->
         
     | 
| 
       2 
2 
     | 
    
         
             
              Spree.addImageHandlers = ->
         
     | 
| 
       3 
3 
     | 
    
         
             
                thumbnails = ($ '#product-images ul.thumbnails')
         
     | 
| 
       4 
4 
     | 
    
         
             
                ($ '#main-image').data 'selectedThumb', ($ '#main-image img').attr('src')
         
     | 
| 
       5 
     | 
    
         
            -
                thumbnails.find('li').eq(0).addClass 'selected'
         
     | 
| 
      
 5 
     | 
    
         
            +
                thumbnails.find('li').eq(0).addClass 'selected' unless thumbnails.find('li.selected').length
         
     | 
| 
       6 
6 
     | 
    
         
             
                thumbnails.find('a').on 'click', (event) ->
         
     | 
| 
       7 
7 
     | 
    
         
             
                  ($ '#main-image').data 'selectedThumb', ($ event.currentTarget).attr('href')
         
     | 
| 
       8 
8 
     | 
    
         
             
                  ($ '#main-image').data 'selectedThumbId', ($ event.currentTarget).parent().attr('id')
         
     | 
| 
         @@ -18,10 +18,11 @@ module Spree 
     | 
|
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
                def update
         
     | 
| 
       20 
20 
     | 
    
         
             
                  if @order.contents.update_cart(order_params)
         
     | 
| 
      
 21 
     | 
    
         
            +
                    @order.next if params.key?(:checkout) && @order.cart?
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
       21 
23 
     | 
    
         
             
                    respond_with(@order) do |format|
         
     | 
| 
       22 
24 
     | 
    
         
             
                      format.html do
         
     | 
| 
       23 
25 
     | 
    
         
             
                        if params.key?(:checkout)
         
     | 
| 
       24 
     | 
    
         
            -
                          @order.next if @order.cart?
         
     | 
| 
       25 
26 
     | 
    
         
             
                          redirect_to checkout_state_path(@order.checkout_steps.first)
         
     | 
| 
       26 
27 
     | 
    
         
             
                        else
         
     | 
| 
       27 
28 
     | 
    
         
             
                          redirect_to cart_path
         
     | 
| 
         @@ -41,27 +42,30 @@ module Spree 
     | 
|
| 
       41 
42 
     | 
    
         | 
| 
       42 
43 
     | 
    
         
             
                # Adds a new item to the order (creating a new order if none already exists)
         
     | 
| 
       43 
44 
     | 
    
         
             
                def populate
         
     | 
| 
       44 
     | 
    
         
            -
                  order 
     | 
| 
      
 45 
     | 
    
         
            +
                  @order   = current_order(create_order_if_necessary: true)
         
     | 
| 
       45 
46 
     | 
    
         
             
                  variant  = Spree::Variant.find(params[:variant_id])
         
     | 
| 
       46 
47 
     | 
    
         
             
                  quantity = params[:quantity].to_i
         
     | 
| 
       47 
48 
     | 
    
         | 
| 
       48 
49 
     | 
    
         
             
                  # 2,147,483,647 is crazy. See issue https://github.com/spree/spree/issues/2695.
         
     | 
| 
       49 
     | 
    
         
            -
                  if quantity.between?(1, 2_147_483_647)
         
     | 
| 
       50 
     | 
    
         
            -
                     
     | 
| 
       51 
     | 
    
         
            -
                      order.contents.add(variant, quantity)
         
     | 
| 
       52 
     | 
    
         
            -
                    rescue ActiveRecord::RecordInvalid => e
         
     | 
| 
       53 
     | 
    
         
            -
                      error = e.record.errors.full_messages.join(", ")
         
     | 
| 
       54 
     | 
    
         
            -
                    end
         
     | 
| 
       55 
     | 
    
         
            -
                  else
         
     | 
| 
       56 
     | 
    
         
            -
                    error = Spree.t(:please_enter_reasonable_quantity)
         
     | 
| 
      
 50 
     | 
    
         
            +
                  if !quantity.between?(1, 2_147_483_647)
         
     | 
| 
      
 51 
     | 
    
         
            +
                    @order.errors.add(:base, Spree.t(:please_enter_reasonable_quantity))
         
     | 
| 
       57 
52 
     | 
    
         
             
                  end
         
     | 
| 
       58 
53 
     | 
    
         | 
| 
       59 
     | 
    
         
            -
                   
     | 
| 
       60 
     | 
    
         
            -
                     
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
      
 54 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 55 
     | 
    
         
            +
                    @line_item = @order.contents.add(variant, quantity)
         
     | 
| 
      
 56 
     | 
    
         
            +
                  rescue ActiveRecord::RecordInvalid => e
         
     | 
| 
      
 57 
     | 
    
         
            +
                    @order.errors.add(:base, e.record.errors.full_messages.join(", "))
         
     | 
| 
      
 58 
     | 
    
         
            +
                  end
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
                  respond_with(@order) do |format|
         
     | 
| 
      
 61 
     | 
    
         
            +
                    format.html do
         
     | 
| 
      
 62 
     | 
    
         
            +
                      if @order.errors.any?
         
     | 
| 
      
 63 
     | 
    
         
            +
                        flash[:error] = @order.errors.full_messages.join(", ")
         
     | 
| 
      
 64 
     | 
    
         
            +
                        redirect_back_or_default(spree.root_path)
         
     | 
| 
      
 65 
     | 
    
         
            +
                        return
         
     | 
| 
      
 66 
     | 
    
         
            +
                      else
         
     | 
| 
      
 67 
     | 
    
         
            +
                        redirect_to cart_path
         
     | 
| 
      
 68 
     | 
    
         
            +
                      end
         
     | 
| 
       65 
69 
     | 
    
         
             
                    end
         
     | 
| 
       66 
70 
     | 
    
         
             
                  end
         
     | 
| 
       67 
71 
     | 
    
         
             
                end
         
     | 
| 
         @@ -2,34 +2,43 @@ 
     | 
|
| 
       2 
2 
     | 
    
         
             
            <div class="inner" data-hook=<%="#{address_type}_inner" %>>
         
     | 
| 
       3 
3 
     | 
    
         
             
              <p class="field" id=<%="#{address_id}firstname" %>>
         
     | 
| 
       4 
4 
     | 
    
         
             
                <%= form.label :firstname, Spree.t(:first_name) %><span class="required">*</span><br />
         
     | 
| 
       5 
     | 
    
         
            -
                <%= form.text_field :firstname, : 
     | 
| 
      
 5 
     | 
    
         
            +
                <%= form.text_field :firstname, class: 'required', autocomplete: address_type + ' given-name' %>
         
     | 
| 
       6 
6 
     | 
    
         
             
              </p>
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
       7 
8 
     | 
    
         
             
              <p class="field" id=<%="#{address_id}lastname" %>>
         
     | 
| 
       8 
9 
     | 
    
         
             
                <%= form.label :lastname, Spree.t(:last_name) %><span class="required">*</span><br />
         
     | 
| 
       9 
     | 
    
         
            -
                <%= form.text_field :lastname, : 
     | 
| 
      
 10 
     | 
    
         
            +
                <%= form.text_field :lastname, autocomplete: address_type + ' family-name' %>
         
     | 
| 
       10 
11 
     | 
    
         
             
              </p>
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
       11 
13 
     | 
    
         
             
              <% if Spree::Config[:company] %>
         
     | 
| 
       12 
14 
     | 
    
         
             
                <p class="field" id=<%="#{address_id}company" %>>
         
     | 
| 
       13 
15 
     | 
    
         
             
                  <%= form.label :company, Spree.t(:company) %><br />
         
     | 
| 
       14 
     | 
    
         
            -
                  <%= form.text_field :company %>
         
     | 
| 
      
 16 
     | 
    
         
            +
                  <%= form.text_field :company, autocomplete: address_type + ' organization' %>
         
     | 
| 
       15 
17 
     | 
    
         
             
                </p>
         
     | 
| 
       16 
18 
     | 
    
         
             
              <% end %>
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
       17 
20 
     | 
    
         
             
              <p class="field" id=<%="#{address_id}address1" %>>
         
     | 
| 
       18 
21 
     | 
    
         
             
                <%= form.label :address1, Spree.t(:street_address) %><span class="required">*</span><br />
         
     | 
| 
       19 
     | 
    
         
            -
                <%= form.text_field :address1, : 
     | 
| 
      
 22 
     | 
    
         
            +
                <%= form.text_field :address1, class: 'required', autocomplete: address_type + ' address-line1' %>
         
     | 
| 
       20 
23 
     | 
    
         
             
              </p>
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
       21 
25 
     | 
    
         
             
              <p class="field" id=<%="#{address_id}address2" %>>
         
     | 
| 
       22 
26 
     | 
    
         
             
                <%= form.label :address2, Spree.t(:street_address_2) %><br />
         
     | 
| 
       23 
     | 
    
         
            -
                <%= form.text_field :address2 %>
         
     | 
| 
      
 27 
     | 
    
         
            +
                <%= form.text_field :address2, autocomplete: address_type + ' address-line2' %>
         
     | 
| 
       24 
28 
     | 
    
         
             
              </p>
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
       25 
30 
     | 
    
         
             
              <p class="field" id=<%="#{address_id}city" %>>
         
     | 
| 
       26 
31 
     | 
    
         
             
                <%= form.label :city, Spree.t(:city) %><span class="required">*</span><br />
         
     | 
| 
       27 
     | 
    
         
            -
                <%= form.text_field :city, : 
     | 
| 
      
 32 
     | 
    
         
            +
                <%= form.text_field :city, class: 'required', autocomplete: address_type + ' address-level2' %>
         
     | 
| 
       28 
33 
     | 
    
         
             
              </p>
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
       29 
35 
     | 
    
         
             
              <p class="field" id=<%="#{address_id}country" %>>
         
     | 
| 
       30 
36 
     | 
    
         
             
                <%= form.label :country_id, Spree.t(:country) %><span class="required">*</span><br />
         
     | 
| 
       31 
37 
     | 
    
         
             
                <span id=<%="#{address_id}country-selection" %>>
         
     | 
| 
       32 
     | 
    
         
            -
                  <%= form.collection_select :country_id, available_countries, :id, :name, {}, 
     | 
| 
      
 38 
     | 
    
         
            +
                  <%= form.collection_select :country_id, available_countries, :id, :name, {},
         
     | 
| 
      
 39 
     | 
    
         
            +
                      class: 'required',
         
     | 
| 
      
 40 
     | 
    
         
            +
                      autocomplete: address_type + ' country-name'
         
     | 
| 
      
 41 
     | 
    
         
            +
                    %>
         
     | 
| 
       33 
42 
     | 
    
         
             
                </span>
         
     | 
| 
       34 
43 
     | 
    
         
             
              </p>
         
     | 
| 
       35 
44 
     | 
    
         | 
| 
         @@ -46,7 +55,8 @@ 
     | 
|
| 
       46 
55 
     | 
    
         
             
                        {
         
     | 
| 
       47 
56 
     | 
    
         
             
                          class: have_states ? 'required' : '',
         
     | 
| 
       48 
57 
     | 
    
         
             
                          style: have_states ? '' : 'display: none;',
         
     | 
| 
       49 
     | 
    
         
            -
                          disabled: !have_states
         
     | 
| 
      
 58 
     | 
    
         
            +
                          disabled: !have_states,
         
     | 
| 
      
 59 
     | 
    
         
            +
                          autocomplete: address_type + ' address-level1'
         
     | 
| 
       50 
60 
     | 
    
         
             
                        })
         
     | 
| 
       51 
61 
     | 
    
         
             
                      %>
         
     | 
| 
       52 
62 
     | 
    
         
             
                    <%=
         
     | 
| 
         @@ -54,28 +64,31 @@ 
     | 
|
| 
       54 
64 
     | 
    
         
             
                        :state_name,
         
     | 
| 
       55 
65 
     | 
    
         
             
                        class: !have_states ? 'required' : '',
         
     | 
| 
       56 
66 
     | 
    
         
             
                        style: have_states ? 'display: none;' : '',
         
     | 
| 
       57 
     | 
    
         
            -
                        disabled: have_states
         
     | 
| 
      
 67 
     | 
    
         
            +
                        disabled: have_states,
         
     | 
| 
      
 68 
     | 
    
         
            +
                        autocomplete: address_type + ' address-level1'
         
     | 
| 
       58 
69 
     | 
    
         
             
                      )
         
     | 
| 
       59 
70 
     | 
    
         
             
                    %>
         
     | 
| 
       60 
71 
     | 
    
         
             
                  </span>
         
     | 
| 
       61 
72 
     | 
    
         
             
                  <noscript>
         
     | 
| 
       62 
     | 
    
         
            -
                    <%= form.text_field :state_name, :class => 'required' %>
         
     | 
| 
      
 73 
     | 
    
         
            +
                    <%= form.text_field :state_name, :class => 'required', autocomplete: address_type + ' address-level1' %>
         
     | 
| 
       63 
74 
     | 
    
         
             
                  </noscript>
         
     | 
| 
       64 
75 
     | 
    
         
             
                </p>
         
     | 
| 
       65 
76 
     | 
    
         
             
              <% end %>
         
     | 
| 
       66 
77 
     | 
    
         | 
| 
       67 
78 
     | 
    
         
             
              <p class="field" id=<%="#{address_id}zipcode" %>>
         
     | 
| 
       68 
79 
     | 
    
         
             
                <%= form.label :zipcode, Spree.t(:zip) %><% if address.require_zipcode? %><span class="required">*</span><% end %><br />
         
     | 
| 
       69 
     | 
    
         
            -
                <%= form.text_field :zipcode, : 
     | 
| 
      
 80 
     | 
    
         
            +
                <%= form.text_field :zipcode, class: "#{'required' if address.require_zipcode?}", autocomplete: address_type + ' postal-code' %>
         
     | 
| 
       70 
81 
     | 
    
         
             
              </p>
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
       71 
83 
     | 
    
         
             
              <p class="field" id=<%="#{address_id}phone" %>>
         
     | 
| 
       72 
84 
     | 
    
         
             
                <%= form.label :phone, Spree.t(:phone) %><% if address.require_phone? %><span class="required">*</span><% end %><br />
         
     | 
| 
       73 
     | 
    
         
            -
                <%= form.phone_field :phone, : 
     | 
| 
      
 85 
     | 
    
         
            +
                <%= form.phone_field :phone, class: "#{'required' if address.require_phone?}", autocomplete: address_type + ' home tel' %>
         
     | 
| 
       74 
86 
     | 
    
         
             
              </p>
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
       75 
88 
     | 
    
         
             
              <% if Spree::Config[:alternative_shipping_phone] %>
         
     | 
| 
       76 
89 
     | 
    
         
             
                <p class="field" id=<%="#{address_id}altphone" %>>
         
     | 
| 
       77 
90 
     | 
    
         
             
                  <%= form.label :alternative_phone, Spree.t(:alternative_phone) %><br />
         
     | 
| 
       78 
     | 
    
         
            -
                  <%= form.phone_field :alternative_phone %>
         
     | 
| 
      
 91 
     | 
    
         
            +
                  <%= form.phone_field :alternative_phone, autocomplete: address_type + ' tel' %>
         
     | 
| 
       79 
92 
     | 
    
         
             
                </p>
         
     | 
| 
       80 
93 
     | 
    
         
             
              <% end %>
         
     | 
| 
       81 
94 
     | 
    
         
             
            </div>
         
     | 
| 
         @@ -29,7 +29,7 @@ 
     | 
|
| 
       29 
29 
     | 
    
         
             
                <% end %>
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
       31 
31 
     | 
    
         
             
                <% if @product.price_for(current_pricing_options) and !@product.price.nil? %>
         
     | 
| 
       32 
     | 
    
         
            -
                  <div data-hook="product_price" class="columns five  
     | 
| 
      
 32 
     | 
    
         
            +
                  <div data-hook="product_price" class="columns five <%= !@product.has_variants? ? 'alpha' : 'omega' %>">
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
       34 
34 
     | 
    
         
             
                    <div id="product-price">
         
     | 
| 
       35 
35 
     | 
    
         
             
                      <h6 class="product-section-title"><%= Spree.t(:price) %></h6>
         
     | 
    
        data/solidus_frontend.gemspec
    CHANGED
    
    | 
         @@ -12,12 +12,15 @@ Gem::Specification.new do |s| 
     | 
|
| 
       12 
12 
     | 
    
         
             
              s.author      = 'Solidus Team'
         
     | 
| 
       13 
13 
     | 
    
         
             
              s.email       = 'contact@solidus.io'
         
     | 
| 
       14 
14 
     | 
    
         
             
              s.homepage    = 'http://solidus.io/'
         
     | 
| 
       15 
     | 
    
         
            -
              s. 
     | 
| 
      
 15 
     | 
    
         
            +
              s.license     = 'BSD-3-Clause'
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
              s.files        = `git ls-files`.split("\n")
         
     | 
| 
       18 
18 
     | 
    
         
             
              s.require_path = 'lib'
         
     | 
| 
       19 
19 
     | 
    
         
             
              s.requirements << 'none'
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
      
 21 
     | 
    
         
            +
              s.required_ruby_version = '>= 2.2.2'
         
     | 
| 
      
 22 
     | 
    
         
            +
              s.required_rubygems_version = '>= 1.8.23'
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
       21 
24 
     | 
    
         
             
              s.add_dependency 'solidus_api', s.version
         
     | 
| 
       22 
25 
     | 
    
         
             
              s.add_dependency 'solidus_core', s.version
         
     | 
| 
       23 
26 
     | 
    
         | 
| 
         @@ -81,9 +81,9 @@ describe Spree::CheckoutController, type: :controller do 
     | 
|
| 
       81 
81 
     | 
    
         
             
                    }
         
     | 
| 
       82 
82 
     | 
    
         
             
                  end
         
     | 
| 
       83 
83 
     | 
    
         | 
| 
       84 
     | 
    
         
            -
                  let!(:payment_method) { create(:payment_method) }
         
     | 
| 
       85 
84 
     | 
    
         
             
                  before do
         
     | 
| 
       86 
85 
     | 
    
         
             
                    # Must have *a* shipping method and a payment method so updating from address works
         
     | 
| 
      
 86 
     | 
    
         
            +
                    allow(order).to receive_messages available_payment_methods: [stub_model(Spree::PaymentMethod)]
         
     | 
| 
       87 
87 
     | 
    
         
             
                    allow(order).to receive_messages ensure_available_shipping_rates: true
         
     | 
| 
       88 
88 
     | 
    
         
             
                    order.line_items << FactoryGirl.create(:line_item)
         
     | 
| 
       89 
89 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -218,53 +218,6 @@ describe Spree::CheckoutController, type: :controller do 
     | 
|
| 
       218 
218 
     | 
    
         
             
                    end
         
     | 
| 
       219 
219 
     | 
    
         
             
                  end
         
     | 
| 
       220 
220 
     | 
    
         | 
| 
       221 
     | 
    
         
            -
                  context "when in the payment state" do
         
     | 
| 
       222 
     | 
    
         
            -
                    let(:order) { create(:order_with_line_items) }
         
     | 
| 
       223 
     | 
    
         
            -
                    let(:payment_method) { create(:credit_card_payment_method) }
         
     | 
| 
       224 
     | 
    
         
            -
             
     | 
| 
       225 
     | 
    
         
            -
                    let(:params) do
         
     | 
| 
       226 
     | 
    
         
            -
                      {
         
     | 
| 
       227 
     | 
    
         
            -
                        state: 'payment',
         
     | 
| 
       228 
     | 
    
         
            -
                        order: {
         
     | 
| 
       229 
     | 
    
         
            -
                          payments_attributes: [
         
     | 
| 
       230 
     | 
    
         
            -
                            {
         
     | 
| 
       231 
     | 
    
         
            -
                              payment_method_id: payment_method.id.to_s,
         
     | 
| 
       232 
     | 
    
         
            -
                              source_attributes: attributes_for(:credit_card)
         
     | 
| 
       233 
     | 
    
         
            -
                            }
         
     | 
| 
       234 
     | 
    
         
            -
                          ]
         
     | 
| 
       235 
     | 
    
         
            -
                        }
         
     | 
| 
       236 
     | 
    
         
            -
                      }
         
     | 
| 
       237 
     | 
    
         
            -
                    end
         
     | 
| 
       238 
     | 
    
         
            -
             
     | 
| 
       239 
     | 
    
         
            -
                    before do
         
     | 
| 
       240 
     | 
    
         
            -
                      order.update_attributes! user: user
         
     | 
| 
       241 
     | 
    
         
            -
                      3.times { order.next! } # should put us in the payment state
         
     | 
| 
       242 
     | 
    
         
            -
                    end
         
     | 
| 
       243 
     | 
    
         
            -
             
     | 
| 
       244 
     | 
    
         
            -
                    context 'with a permitted payment method' do
         
     | 
| 
       245 
     | 
    
         
            -
                      it 'sets the payment amount' do
         
     | 
| 
       246 
     | 
    
         
            -
                        post :update, params: params
         
     | 
| 
       247 
     | 
    
         
            -
                        order.reload
         
     | 
| 
       248 
     | 
    
         
            -
                        expect(order.state).to eq('confirm')
         
     | 
| 
       249 
     | 
    
         
            -
                        expect(order.payments.size).to eq(1)
         
     | 
| 
       250 
     | 
    
         
            -
                        expect(order.payments.first.amount).to eq(order.total)
         
     | 
| 
       251 
     | 
    
         
            -
                      end
         
     | 
| 
       252 
     | 
    
         
            -
                    end
         
     | 
| 
       253 
     | 
    
         
            -
             
     | 
| 
       254 
     | 
    
         
            -
                    context 'with an unpermitted payment method' do
         
     | 
| 
       255 
     | 
    
         
            -
                      before { payment_method.update!(display_on: "back_end") }
         
     | 
| 
       256 
     | 
    
         
            -
             
     | 
| 
       257 
     | 
    
         
            -
                      it 'sets the payment amount' do
         
     | 
| 
       258 
     | 
    
         
            -
                        expect {
         
     | 
| 
       259 
     | 
    
         
            -
                          post :update, params: params
         
     | 
| 
       260 
     | 
    
         
            -
                        }.to raise_error(ActiveRecord::RecordNotFound)
         
     | 
| 
       261 
     | 
    
         
            -
             
     | 
| 
       262 
     | 
    
         
            -
                        expect(order.state).to eq('payment')
         
     | 
| 
       263 
     | 
    
         
            -
                        expect(order.payments).to be_empty
         
     | 
| 
       264 
     | 
    
         
            -
                      end
         
     | 
| 
       265 
     | 
    
         
            -
                    end
         
     | 
| 
       266 
     | 
    
         
            -
                  end
         
     | 
| 
       267 
     | 
    
         
            -
             
     | 
| 
       268 
221 
     | 
    
         
             
                  context "when in the confirm state" do
         
     | 
| 
       269 
222 
     | 
    
         
             
                    before do
         
     | 
| 
       270 
223 
     | 
    
         
             
                      order.update_attributes! user: user
         
     | 
| 
         @@ -18,7 +18,12 @@ describe Spree::OrdersController, type: :controller do 
     | 
|
| 
       18 
18 
     | 
    
         
             
                  it "should create a new order when none specified" do
         
     | 
| 
       19 
19 
     | 
    
         
             
                    post :populate
         
     | 
| 
       20 
20 
     | 
    
         
             
                    expect(cookies.signed[:guest_token]).not_to be_blank
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                    order_by_token = Spree::Order.find_by_guest_token(cookies.signed[:guest_token])
         
     | 
| 
      
 23 
     | 
    
         
            +
                    assigned_order = assigns[:order]
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                    expect(assigned_order).to eq order_by_token
         
     | 
| 
      
 26 
     | 
    
         
            +
                    expect(assigned_order).to be_persisted
         
     | 
| 
       22 
27 
     | 
    
         
             
                  end
         
     | 
| 
       23 
28 
     | 
    
         | 
| 
       24 
29 
     | 
    
         
             
                  context "with Variant" do
         
     | 
| 
         @@ -85,6 +90,13 @@ describe Spree::OrdersController, type: :controller do 
     | 
|
| 
       85 
90 
     | 
    
         
             
                      put :update, session: { order_id: 1 }
         
     | 
| 
       86 
91 
     | 
    
         
             
                      expect(response).to redirect_to(spree.cart_path)
         
     | 
| 
       87 
92 
     | 
    
         
             
                    end
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
                    it "should advance the order if :checkout button is pressed" do
         
     | 
| 
      
 95 
     | 
    
         
            +
                      allow(order).to receive(:update_attributes).and_return true
         
     | 
| 
      
 96 
     | 
    
         
            +
                      expect(order).to receive(:next)
         
     | 
| 
      
 97 
     | 
    
         
            +
                      put :update, { checkout: true }, { order_id: 1 }
         
     | 
| 
      
 98 
     | 
    
         
            +
                      expect(response).to redirect_to checkout_state_path('address')
         
     | 
| 
      
 99 
     | 
    
         
            +
                    end
         
     | 
| 
       88 
100 
     | 
    
         
             
                  end
         
     | 
| 
       89 
101 
     | 
    
         
             
                end
         
     | 
| 
       90 
102 
     | 
    
         | 
| 
         @@ -77,9 +77,9 @@ describe "Checkout", type: :feature, inaccessible: true do 
     | 
|
| 
       77 
77 
     | 
    
         | 
| 
       78 
78 
     | 
    
         
             
              # Regression test for https://github.com/spree/spree/issues/2694 and https://github.com/spree/spree/issues/4117
         
     | 
| 
       79 
79 
     | 
    
         
             
              context "doesn't allow bad credit card numbers" do
         
     | 
| 
       80 
     | 
    
         
            -
                let!(:payment_method) { create(:credit_card_payment_method) }
         
     | 
| 
       81 
80 
     | 
    
         
             
                before(:each) do
         
     | 
| 
       82 
81 
     | 
    
         
             
                  order = OrderWalkthrough.up_to(:delivery)
         
     | 
| 
      
 82 
     | 
    
         
            +
                  allow(order).to receive_messages(available_payment_methods: [create(:credit_card_payment_method)])
         
     | 
| 
       83 
83 
     | 
    
         | 
| 
       84 
84 
     | 
    
         
             
                  user = create(:user)
         
     | 
| 
       85 
85 
     | 
    
         
             
                  order.user = user
         
     | 
| 
         @@ -180,8 +180,7 @@ describe "Checkout", type: :feature, inaccessible: true do 
     | 
|
| 
       180 
180 
     | 
    
         
             
              end
         
     | 
| 
       181 
181 
     | 
    
         | 
| 
       182 
182 
     | 
    
         
             
              context "user has payment sources", js: true do
         
     | 
| 
       183 
     | 
    
         
            -
                 
     | 
| 
       184 
     | 
    
         
            -
                let!(:bogus) { create(:credit_card_payment_method) }
         
     | 
| 
      
 183 
     | 
    
         
            +
                let(:bogus) { create(:credit_card_payment_method) }
         
     | 
| 
       185 
184 
     | 
    
         
             
                let(:user) { create(:user) }
         
     | 
| 
       186 
185 
     | 
    
         | 
| 
       187 
186 
     | 
    
         
             
                let!(:credit_card) do
         
     | 
| 
         @@ -190,6 +189,7 @@ describe "Checkout", type: :feature, inaccessible: true do 
     | 
|
| 
       190 
189 
     | 
    
         | 
| 
       191 
190 
     | 
    
         
             
                before do
         
     | 
| 
       192 
191 
     | 
    
         
             
                  order = OrderWalkthrough.up_to(:delivery)
         
     | 
| 
      
 192 
     | 
    
         
            +
                  allow(order).to receive_messages(available_payment_methods: [bogus])
         
     | 
| 
       193 
193 
     | 
    
         | 
| 
       194 
194 
     | 
    
         
             
                  allow_any_instance_of(Spree::CheckoutController).to receive_messages(current_order: order)
         
     | 
| 
       195 
195 
     | 
    
         
             
                  allow_any_instance_of(Spree::CheckoutController).to receive_messages(try_spree_current_user: user)
         
     | 
| 
         @@ -15,15 +15,14 @@ describe "Free shipping promotions", type: :feature, js: true do 
     | 
|
| 
       15 
15 
     | 
    
         
             
              let!(:payment_method) { create(:check_payment_method) }
         
     | 
| 
       16 
16 
     | 
    
         
             
              let!(:product) { create(:product, name: "RoR Mug", price: 20) }
         
     | 
| 
       17 
17 
     | 
    
         
             
              let!(:promotion) do
         
     | 
| 
       18 
     | 
    
         
            -
                 
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                promotion.reload # so that promotion.actions is available
         
     | 
| 
      
 18 
     | 
    
         
            +
                create(
         
     | 
| 
      
 19 
     | 
    
         
            +
                  :promotion,
         
     | 
| 
      
 20 
     | 
    
         
            +
                  apply_automatically: true,
         
     | 
| 
      
 21 
     | 
    
         
            +
                  promotion_actions: [Spree::Promotion::Actions::FreeShipping.new],
         
     | 
| 
      
 22 
     | 
    
         
            +
                  name: "Free Shipping",
         
     | 
| 
      
 23 
     | 
    
         
            +
                  starts_at: 1.day.ago,
         
     | 
| 
      
 24 
     | 
    
         
            +
                  expires_at: 1.day.from_now,
         
     | 
| 
      
 25 
     | 
    
         
            +
                )
         
     | 
| 
       27 
26 
     | 
    
         
             
              end
         
     | 
| 
       28 
27 
     | 
    
         | 
| 
       29 
28 
     | 
    
         
             
              context "free shipping promotion automatically applied" do
         
     | 
| 
         @@ -40,7 +40,7 @@ describe 'setting locale', type: :feature do 
     | 
|
| 
       40 
40 
     | 
    
         
             
                    visit '/checkout/address'
         
     | 
| 
       41 
41 
     | 
    
         
             
                    find('.form-buttons input[type=submit]').click
         
     | 
| 
       42 
42 
     | 
    
         | 
| 
       43 
     | 
    
         
            -
                    %w(firstname  
     | 
| 
      
 43 
     | 
    
         
            +
                    %w(firstname address1 city).each do |attr|
         
     | 
| 
       44 
44 
     | 
    
         
             
                      expect(find(".field#b#{attr} label.error")).to have_text(message)
         
     | 
| 
       45 
45 
     | 
    
         
             
                    end
         
     | 
| 
       46 
46 
     | 
    
         
             
                  end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: solidus_frontend
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 2.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.1.0.beta1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Solidus Team
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-12-06 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: solidus_api
         
     | 
| 
         @@ -16,28 +16,28 @@ dependencies: 
     | 
|
| 
       16 
16 
     | 
    
         
             
                requirements:
         
     | 
| 
       17 
17 
     | 
    
         
             
                - - '='
         
     | 
| 
       18 
18 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       19 
     | 
    
         
            -
                    version: 2.0. 
     | 
| 
      
 19 
     | 
    
         
            +
                    version: 2.1.0.beta1
         
     | 
| 
       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: 2.0. 
     | 
| 
      
 26 
     | 
    
         
            +
                    version: 2.1.0.beta1
         
     | 
| 
       27 
27 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       28 
28 
     | 
    
         
             
              name: solidus_core
         
     | 
| 
       29 
29 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       30 
30 
     | 
    
         
             
                requirements:
         
     | 
| 
       31 
31 
     | 
    
         
             
                - - '='
         
     | 
| 
       32 
32 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       33 
     | 
    
         
            -
                    version: 2.0. 
     | 
| 
      
 33 
     | 
    
         
            +
                    version: 2.1.0.beta1
         
     | 
| 
       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: 2.0. 
     | 
| 
      
 40 
     | 
    
         
            +
                    version: 2.1.0.beta1
         
     | 
| 
       41 
41 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       42 
42 
     | 
    
         
             
              name: canonical-rails
         
     | 
| 
       43 
43 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -212,7 +212,6 @@ files: 
     | 
|
| 
       212 
212 
     | 
    
         
             
            - app/views/spree/shared/_address.html.erb
         
     | 
| 
       213 
213 
     | 
    
         
             
            - app/views/spree/shared/_filters.html.erb
         
     | 
| 
       214 
214 
     | 
    
         
             
            - app/views/spree/shared/_footer.html.erb
         
     | 
| 
       215 
     | 
    
         
            -
            - app/views/spree/shared/_google_analytics.html.erb
         
     | 
| 
       216 
215 
     | 
    
         
             
            - app/views/spree/shared/_head.html.erb
         
     | 
| 
       217 
216 
     | 
    
         
             
            - app/views/spree/shared/_header.html.erb
         
     | 
| 
       218 
217 
     | 
    
         
             
            - app/views/spree/shared/_link_to_cart.html.erb
         
     | 
| 
         @@ -274,7 +273,6 @@ files: 
     | 
|
| 
       274 
273 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
       275 
274 
     | 
    
         
             
            - spec/support/shared_contexts/checkout_setup.rb
         
     | 
| 
       276 
275 
     | 
    
         
             
            - spec/support/shared_contexts/custom_products.rb
         
     | 
| 
       277 
     | 
    
         
            -
            - spec/support/shared_contexts/product_prototypes.rb
         
     | 
| 
       278 
276 
     | 
    
         
             
            - spec/views/spree/checkout/_summary_spec.rb
         
     | 
| 
       279 
277 
     | 
    
         
             
            - vendor/assets/javascripts/jquery.validate/additional-methods.min.js
         
     | 
| 
       280 
278 
     | 
    
         
             
            - vendor/assets/javascripts/jquery.validate/jquery.validate.min.js
         
     | 
| 
         @@ -327,7 +325,8 @@ files: 
     | 
|
| 
       327 
325 
     | 
    
         
             
            - vendor/assets/javascripts/jquery.validate/localization/methods_nl.js
         
     | 
| 
       328 
326 
     | 
    
         
             
            - vendor/assets/javascripts/jquery.validate/localization/methods_pt.js
         
     | 
| 
       329 
327 
     | 
    
         
             
            homepage: http://solidus.io/
         
     | 
| 
       330 
     | 
    
         
            -
            licenses: 
     | 
| 
      
 328 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 329 
     | 
    
         
            +
            - BSD-3-Clause
         
     | 
| 
       331 
330 
     | 
    
         
             
            metadata: {}
         
     | 
| 
       332 
331 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       333 
332 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
         @@ -337,16 +336,16 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       337 
336 
     | 
    
         
             
              requirements:
         
     | 
| 
       338 
337 
     | 
    
         
             
              - - ">="
         
     | 
| 
       339 
338 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       340 
     | 
    
         
            -
                  version: 2. 
     | 
| 
      
 339 
     | 
    
         
            +
                  version: 2.2.2
         
     | 
| 
       341 
340 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       342 
341 
     | 
    
         
             
              requirements:
         
     | 
| 
       343 
342 
     | 
    
         
             
              - - ">="
         
     | 
| 
       344 
343 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       345 
     | 
    
         
            -
                  version:  
     | 
| 
      
 344 
     | 
    
         
            +
                  version: 1.8.23
         
     | 
| 
       346 
345 
     | 
    
         
             
            requirements:
         
     | 
| 
       347 
346 
     | 
    
         
             
            - none
         
     | 
| 
       348 
     | 
    
         
            -
            rubyforge_project:  
     | 
| 
       349 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 347 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 348 
     | 
    
         
            +
            rubygems_version: 2.5.2
         
     | 
| 
       350 
349 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       351 
350 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       352 
351 
     | 
    
         
             
            summary: Cart and storefront for the Solidus e-commerce project.
         
     | 
| 
         @@ -1,36 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            <% if tracker = Spree::Tracker.current %>
         
     | 
| 
       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 
     | 
    
         
            -
                ga('create', '<%= tracker.analytics_id %>', 'auto');
         
     | 
| 
       9 
     | 
    
         
            -
                ga('require', 'displayfeatures');
         
     | 
| 
       10 
     | 
    
         
            -
                ga('send', 'pageview');
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
                <% if @order && order_just_completed?(@order) %>
         
     | 
| 
       13 
     | 
    
         
            -
                  <%# more info: https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce %>
         
     | 
| 
       14 
     | 
    
         
            -
                  ga('require', 'ecommerce', 'ecommerce.js');
         
     | 
| 
       15 
     | 
    
         
            -
                  ga('ecommerce:addTransaction', {
         
     | 
| 
       16 
     | 
    
         
            -
                    'id': '<%= j @order.number %>',                                    // Transaction ID. Required.
         
     | 
| 
       17 
     | 
    
         
            -
                    'affiliation': '<%= current_store.name %>',                 // Affiliation or store name.
         
     | 
| 
       18 
     | 
    
         
            -
                    'revenue': '<%= @order.total %>',                                // Grand Total.
         
     | 
| 
       19 
     | 
    
         
            -
                    'shipping': '<%= @order.ship_total %>',                                  // Shipping.
         
     | 
| 
       20 
     | 
    
         
            -
                    'tax': '<%= @order.tax_total %>',                                        // Tax.
         
     | 
| 
       21 
     | 
    
         
            -
                    'currency': '<%= @order.currency %>'                        // local currency code.
         
     | 
| 
       22 
     | 
    
         
            -
                  });
         
     | 
| 
       23 
     | 
    
         
            -
                  <% @order.line_items.each do |line_item| %>
         
     | 
| 
       24 
     | 
    
         
            -
                    ga('ecommerce:addItem', {
         
     | 
| 
       25 
     | 
    
         
            -
                      'id': '<%= j @order.number %>',                        // Transaction ID. Required.
         
     | 
| 
       26 
     | 
    
         
            -
                      'name': '<%= j line_item.variant.product.name %>',    // Product name. Required.
         
     | 
| 
       27 
     | 
    
         
            -
                      'sku': '<%= j (line_item.variant.sku || line_item.variant_id) %>', // SKU/code.
         
     | 
| 
       28 
     | 
    
         
            -
                      'category': '',                                     // Category or variation.
         
     | 
| 
       29 
     | 
    
         
            -
                      'price': '<%= line_item.price %>',                 // Unit price.
         
     | 
| 
       30 
     | 
    
         
            -
                      'quantity': '<%= line_item.quantity %>'           // Quantity.
         
     | 
| 
       31 
     | 
    
         
            -
                    });
         
     | 
| 
       32 
     | 
    
         
            -
                  <% end %>
         
     | 
| 
       33 
     | 
    
         
            -
                  ga('ecommerce:send');
         
     | 
| 
       34 
     | 
    
         
            -
                <% end %>
         
     | 
| 
       35 
     | 
    
         
            -
              </script>
         
     | 
| 
       36 
     | 
    
         
            -
            <% end %>
         
     | 
| 
         @@ -1,28 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            shared_context "product prototype" do
         
     | 
| 
       2 
     | 
    
         
            -
              def build_option_type_with_values(name, values)
         
     | 
| 
       3 
     | 
    
         
            -
                ot = FactoryGirl.create(:option_type, name: name)
         
     | 
| 
       4 
     | 
    
         
            -
                values.each do |val|
         
     | 
| 
       5 
     | 
    
         
            -
                  ot.option_values.create(name: val.downcase, presentation: val)
         
     | 
| 
       6 
     | 
    
         
            -
                end
         
     | 
| 
       7 
     | 
    
         
            -
                ot
         
     | 
| 
       8 
     | 
    
         
            -
              end
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
              let(:product_attributes) do
         
     | 
| 
       11 
     | 
    
         
            -
                # FactoryGirl.attributes_for is un-deprecated!
         
     | 
| 
       12 
     | 
    
         
            -
                #   https://github.com/thoughtbot/factory_girl/issues/274#issuecomment-3592054
         
     | 
| 
       13 
     | 
    
         
            -
                FactoryGirl.attributes_for(:base_product)
         
     | 
| 
       14 
     | 
    
         
            -
              end
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
              let(:prototype) do
         
     | 
| 
       17 
     | 
    
         
            -
                size = build_option_type_with_values("size", %w(Small Medium Large))
         
     | 
| 
       18 
     | 
    
         
            -
                FactoryGirl.create(:prototype, name: "Size", option_types: [size])
         
     | 
| 
       19 
     | 
    
         
            -
              end
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
              let(:option_values_hash) do
         
     | 
| 
       22 
     | 
    
         
            -
                hash = {}
         
     | 
| 
       23 
     | 
    
         
            -
                prototype.option_types.each do |i|
         
     | 
| 
       24 
     | 
    
         
            -
                  hash[i.id.to_s] = i.option_value_ids
         
     | 
| 
       25 
     | 
    
         
            -
                end
         
     | 
| 
       26 
     | 
    
         
            -
                hash
         
     | 
| 
       27 
     | 
    
         
            -
              end
         
     | 
| 
       28 
     | 
    
         
            -
            end
         
     |