spree_frontend 2.0.13 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7a039b779e5f75ac81e16d595e114544a5d986c
4
- data.tar.gz: cdacb062f594ba18396893401285135ba01fc5b7
3
+ metadata.gz: 8f2bda97082288faab57d08de2ab077233dd47c6
4
+ data.tar.gz: 923864456f4fb1cb0d7ccd8ed2bb7c78b478c5a7
5
5
  SHA512:
6
- metadata.gz: 154a854bd5aad0edb7ffa53eecd2e6fa0b6d29aff58c678eb2469e474c47346b1243691b832d173dcd3ac55163aecee7e12b1f0f2e762d2a2ffe9d2daaf00073
7
- data.tar.gz: da796d1b439a75b46c9a22dea36956300bfbe12c4df8d15b49913ff5371753ac4efca6b4bced5e7d7e52c6b8a982222933c7134fc800779ab99caa9bed6b41ab
6
+ metadata.gz: 39c227a8f797b5ec0e403fbede9cd317f5dad891def3ad480cca6dc49744cacb128c36cb8282c02aa4313163e042d0e7fafe45f24ef543648f65fb860e13cb18
7
+ data.tar.gz: a8cc031d6638a823550a7e573136643c8881542ac913c6fd61a6c160bf12e1064cc8d9e517ae9e580ecfc1f2c1337432a73d25c319feb40fdf57bcf1c87d62df
@@ -1,16 +1,25 @@
1
+ //= require jquery.payment
2
+
1
3
  Spree.disableSaveOnClick = ->
2
4
  ($ 'form.edit_order').submit ->
3
5
  ($ this).find(':submit, :image').attr('disabled', true).removeClass('primary').addClass 'disabled'
4
6
 
5
7
  Spree.ready ($) ->
6
8
  Spree.Checkout = {}
9
+ $("#card_number").payment('formatCardNumber')
10
+ $("#card_expiry").payment('formatCardExpiry')
11
+ $("#card_code").payment('formatCardCVC')
12
+
13
+ $("#card_number").change ->
14
+ $("#cc_type").val($.payment.cardType(@value))
15
+
7
16
  if ($ '#checkout_form_address').is('*')
8
17
  ($ '#checkout_form_address').validate()
9
18
 
10
19
  getCountryId = (region) ->
11
- $('#' + region + 'country select').val()
20
+ $('p#' + region + 'country select').val()
12
21
 
13
- Spree.updateState = (region) ->
22
+ updateState = (region) ->
14
23
  countryId = getCountryId(region)
15
24
  if countryId?
16
25
  unless Spree.Checkout[countryId]?
@@ -18,15 +27,15 @@ Spree.ready ($) ->
18
27
  Spree.Checkout[countryId] =
19
28
  states: data.states
20
29
  states_required: data.states_required
21
- Spree.fillStates(Spree.Checkout[countryId], region)
30
+ fillStates(Spree.Checkout[countryId], region)
22
31
  else
23
- Spree.fillStates(Spree.Checkout[countryId], region)
32
+ fillStates(Spree.Checkout[countryId], region)
24
33
 
25
- Spree.fillStates = (data, region) ->
34
+ fillStates = (data, region) ->
26
35
  statesRequired = data.states_required
27
36
  states = data.states
28
37
 
29
- statePara = ($ '#' + region + 'state')
38
+ statePara = ($ 'p#' + region + 'state')
30
39
  stateSelect = statePara.find('select')
31
40
  stateInput = statePara.find('input')
32
41
  stateSpanRequired = statePara.find('state-required')
@@ -44,6 +53,7 @@ Spree.ready ($) ->
44
53
  statePara.show()
45
54
  stateSpanRequired.show()
46
55
  stateSelect.addClass('required') if statesRequired
56
+ stateSelect.removeClass('hidden')
47
57
  stateInput.removeClass('required')
48
58
  else
49
59
  stateSelect.hide().prop 'disabled', true
@@ -60,13 +70,13 @@ Spree.ready ($) ->
60
70
  stateInput.removeClass('hidden')
61
71
  stateSelect.removeClass('required')
62
72
 
63
- ($ '#bcountry select').change ->
64
- Spree.updateState 'b'
73
+ ($ 'p#bcountry select').change ->
74
+ updateState 'b'
65
75
 
66
- ($ '#scountry select').change ->
67
- Spree.updateState 's'
76
+ ($ 'p#scountry select').change ->
77
+ updateState 's'
68
78
 
69
- Spree.updateState 'b'
79
+ updateState 'b'
70
80
 
71
81
  order_use_billing = ($ 'input#order_use_billing')
72
82
  order_use_billing.change ->
@@ -79,7 +89,7 @@ Spree.ready ($) ->
79
89
  else
80
90
  ($ '#shipping .inner').show()
81
91
  ($ '#shipping .inner input, #shipping .inner select').prop 'disabled', false
82
- Spree.updateState('s')
92
+ updateState('s')
83
93
 
84
94
  update_shipping_form_state order_use_billing
85
95
 
@@ -22,10 +22,10 @@ $ ->
22
22
  ($ 'li.tmb-' + variantId).show()
23
23
  currentThumb = ($ '#' + ($ '#main-image').data('selectedThumbId'))
24
24
  if not currentThumb.hasClass('vtmb-' + variantId)
25
- thumb = ($ ($ '#product-images ul.thumbnails li:visible.vtmb').eq(0))
26
- thumb = ($ ($ '#product-images ul.thumbnails li:visible').eq(0)) unless thumb.length > 0
25
+ thumb = ($ ($ 'ul.thumbnails li:visible.vtmb').eq(0))
26
+ thumb = ($ ($ 'ul.thumbnails li:visible').eq(0)) unless thumb.length > 0
27
27
  newImg = thumb.find('a').attr('href')
28
- ($ '#product-images ul.thumbnails li').removeClass 'selected'
28
+ ($ 'ul.thumbnails li').removeClass 'selected'
29
29
  thumb.addClass 'selected'
30
30
  ($ '#main-image img').attr 'src', newImg
31
31
  ($ '#main-image').data 'selectedThumb', newImg
@@ -1,4 +1,4 @@
1
- @import 'store/variables';
1
+ @import 'variables';
2
2
 
3
3
  /*--------------------------------------*/
4
4
  /* Basic styles
@@ -113,16 +113,12 @@ input[type="password"], input[type="search"], input[type="tel"],
113
113
  input[type="text"], input[type="time"], input[type="url"],
114
114
  input[type="week"] {
115
115
  border: $default_border;
116
- padding: 5px;
116
+ padding: 5px 10px;
117
117
  font-family: $ff_base;
118
118
  font-size: $input_box_font_size;
119
119
 
120
- -webkit-box-sizing: border-box;
121
- -moz-box-sizing: border-box;
122
- box-sizing: border-box;
123
-
124
120
  &:active, &:focus {
125
- border-color: $link_text_color;
121
+ border-color: $link_text_color;;
126
122
  outline: none;
127
123
  -webkit-box-shadow: none;
128
124
  -moz-box-shadow: none;
@@ -150,11 +146,6 @@ span.required {
150
146
 
151
147
  fieldset {
152
148
  margin: 0;
153
- min-width: 100%;
154
-
155
- -webkit-box-sizing: border-box;
156
- -moz-box-sizing: border-box;
157
- box-sizing: border-box;
158
149
  }
159
150
 
160
151
  input[type="submit"], input[type="button"],
@@ -309,7 +300,7 @@ nav #main-nav-bar {
309
300
  &#link-to-cart {
310
301
  float: right;
311
302
  padding-left: 24px;
312
- background: asset-url("store/cart.png", image) no-repeat left center;
303
+ background: url("cart.png") no-repeat left center;
313
304
 
314
305
  &:hover {
315
306
  border-color: $link_text_color;
@@ -736,14 +727,6 @@ ul#products {
736
727
  }
737
728
  }
738
729
 
739
- #billing {
740
- input[type="text"], input[type="email"],
741
- input[type="tel"], input[type="number"],
742
- select, textarea {
743
- width: 100%;
744
- }
745
- }
746
-
747
730
  #order_details, #order_summary {
748
731
  padding: 0;
749
732
 
@@ -6,7 +6,7 @@ module Spree
6
6
  class CheckoutController < Spree::StoreController
7
7
  ssl_required
8
8
 
9
- before_filter :load_order_with_lock
9
+ before_filter :load_order
10
10
 
11
11
  before_filter :ensure_order_not_completed
12
12
  before_filter :ensure_checkout_allowed
@@ -26,8 +26,6 @@ module Spree
26
26
  # Updates the order and advances to the next state (when possible.)
27
27
  def update
28
28
  if @order.update_attributes(object_params)
29
- fire_event('spree.checkout.update')
30
-
31
29
  unless @order.next
32
30
  flash[:error] = @order.errors.full_messages.join("\n")
33
31
  redirect_to checkout_state_path(@order.state) and return
@@ -55,13 +53,6 @@ module Spree
55
53
  redirect_to checkout_state_path(@order.checkout_steps.first)
56
54
  end
57
55
  end
58
-
59
- # Fix for #4117
60
- # If confirmation of payment fails, redirect back to payment screen
61
- if params[:state] == "confirm" && @order.payments.valid.empty?
62
- flash.keep
63
- redirect_to checkout_state_path("payment")
64
- end
65
56
  end
66
57
 
67
58
  # Should be overriden if you have areas of your checkout that don't match
@@ -70,8 +61,8 @@ module Spree
70
61
  false
71
62
  end
72
63
 
73
- def load_order_with_lock
74
- @order = current_order(lock: true)
64
+ def load_order
65
+ @order = current_order
75
66
  redirect_to spree.cart_path and return unless @order
76
67
 
77
68
  if params[:state]
@@ -106,7 +97,7 @@ module Spree
106
97
  # attributes for a single payment and its source, discarding attributes
107
98
  # for payment methods other than the one selected
108
99
  def object_params
109
- # has_checkout_step? check is necessary due to issue described in #2910
100
+ # respond_to check is necessary due to issue described in #2910
110
101
  if @order.has_checkout_step?("payment") && @order.payment?
111
102
  if params[:payment_source].present?
112
103
  source_params = params.delete(:payment_source)[params[:order][:payments_attributes].first[:payment_method_id].underscore]
@@ -120,7 +111,12 @@ module Spree
120
111
  params[:order][:payments_attributes].first[:amount] = @order.total
121
112
  end
122
113
  end
123
- params[:order]
114
+
115
+ if params[:order]
116
+ params[:order].permit(permitted_checkout_attributes)
117
+ else
118
+ {}
119
+ end
124
120
  end
125
121
 
126
122
  def setup_for_current_state
@@ -155,9 +151,8 @@ module Spree
155
151
  end
156
152
  end
157
153
 
158
- def rescue_from_spree_gateway_error(exception)
159
- flash.now[:error] = Spree.t(:spree_gateway_error_flash_for_checkout)
160
- @order.errors.add(:base, exception.message)
154
+ def rescue_from_spree_gateway_error
155
+ flash[:error] = Spree.t(:spree_gateway_error_flash_for_checkout)
161
156
  render :edit
162
157
  end
163
158
 
@@ -167,13 +162,13 @@ module Spree
167
162
 
168
163
  def apply_coupon_code
169
164
  if params[:order] && params[:order][:coupon_code]
170
- @order.coupon_code = params[:order][:coupon_code]
165
+ @order.coupon_code = params[:order][:coupon_code]
171
166
 
172
167
  coupon_result = Spree::Promo::CouponApplicator.new(@order).apply
173
168
  if coupon_result[:coupon_applied?]
174
169
  flash[:success] = coupon_result[:success] if coupon_result[:success].present?
175
170
  else
176
- flash.now[:error] = coupon_result[:error]
171
+ flash[:error] = coupon_result[:error]
177
172
  respond_with(@order) { |format| format.html { render :edit } } and return
178
173
  end
179
174
  end
@@ -6,7 +6,6 @@ module Spree
6
6
  after_filter :fire_visited_action, :except => :show
7
7
 
8
8
  rescue_from ActionView::MissingTemplate, :with => :render_404
9
- caches_page :show, :index, :if => Proc.new { Spree::Config[:cache_static_content] }
10
9
 
11
10
  respond_to :html
12
11
 
@@ -13,13 +13,13 @@ module Spree
13
13
  end
14
14
 
15
15
  def update
16
- @order = current_order(lock: true)
16
+ @order = current_order
17
17
  unless @order
18
18
  flash[:error] = Spree.t(:order_not_found)
19
19
  redirect_to root_path and return
20
20
  end
21
21
 
22
- if @order.update_attributes(params[:order])
22
+ if @order.update_attributes(order_params)
23
23
  @order.line_items = @order.line_items.select {|li| li.quantity > 0 }
24
24
  @order.ensure_updated_shipments
25
25
  return if after_update_attributes
@@ -29,7 +29,7 @@ module Spree
29
29
  respond_with(@order) do |format|
30
30
  format.html do
31
31
  if params.has_key?(:checkout)
32
- @order.next if @order.cart?
32
+ @order.next_transition.run_callbacks if @order.cart?
33
33
  redirect_to checkout_state_path(@order.checkout_steps.first)
34
34
  else
35
35
  redirect_to cart_path
@@ -43,13 +43,13 @@ module Spree
43
43
 
44
44
  # Shows the current incomplete order from the session
45
45
  def edit
46
- @order = current_order(create_order_if_necessary: true)
46
+ @order = current_order(true)
47
47
  associate_user
48
48
  end
49
49
 
50
50
  # Adds a new item to the order (creating a new order if none already exists)
51
51
  def populate
52
- populator = Spree::OrderPopulator.new(current_order(create_order_if_necessary: true), current_currency)
52
+ populator = Spree::OrderPopulator.new(current_order(true), current_currency)
53
53
  if populator.populate(params.slice(:products, :variants, :quantity))
54
54
  current_order.ensure_updated_shipments
55
55
 
@@ -89,16 +89,24 @@ module Spree
89
89
 
90
90
  private
91
91
 
92
- def after_update_attributes
93
- coupon_result = Spree::Promo::CouponApplicator.new(@order).apply
94
- if coupon_result[:coupon_applied?]
95
- flash[:success] = coupon_result[:success] if coupon_result[:success].present?
96
- return false
97
- else
98
- flash.now[:error] = coupon_result[:error]
99
- respond_with(@order) { |format| format.html { render :edit } }
100
- return true
92
+ def order_params
93
+ if params[:order]
94
+ params[:order].permit(*permitted_order_attributes)
95
+ else
96
+ {}
97
+ end
98
+ end
99
+
100
+ def after_update_attributes
101
+ coupon_result = Spree::Promo::CouponApplicator.new(@order).apply
102
+ if coupon_result[:coupon_applied?]
103
+ flash[:success] = coupon_result[:success] if coupon_result[:success].present?
104
+ return false
105
+ else
106
+ flash[:error] = coupon_result[:error]
107
+ respond_with(@order) { |format| format.html { render :edit } }
108
+ return true
109
+ end
101
110
  end
102
- end
103
111
  end
104
112
  end
@@ -1,8 +1,6 @@
1
1
  module Spree
2
2
  class ProductsController < Spree::StoreController
3
3
  before_filter :load_product, :only => :show
4
- before_filter :load_taxon, :only => :index
5
-
6
4
  rescue_from ActiveRecord::RecordNotFound, :with => :render_404
7
5
  helper 'spree/taxons'
8
6
 
@@ -28,7 +26,7 @@ module Spree
28
26
  # Do nothing
29
27
  else
30
28
  if referer_path && referer_path.match(/\/t\/(.*)/)
31
- @taxon = Spree::Taxon.find_by_permalink($1)
29
+ @taxon = Taxon.find_by_permalink($1)
32
30
  end
33
31
  end
34
32
  end
@@ -46,9 +44,5 @@ module Spree
46
44
  @product = Product.active(current_currency).find_by_permalink!(params[:id])
47
45
  end
48
46
  end
49
-
50
- def load_taxon
51
- @taxon = Spree::Taxon.find(params[:taxon]) if params[:taxon].present?
52
- end
53
47
  end
54
48
  end
@@ -7,10 +7,9 @@ module Spree
7
7
  end
8
8
 
9
9
  protected
10
-
11
- def config_locale
12
- Spree::Frontend::Config[:locale]
13
- end
10
+ def config_locale
11
+ Spree::Frontend::Config[:locale]
12
+ end
14
13
  end
15
14
  end
16
15
 
@@ -1,6 +1,6 @@
1
1
  <fieldset id="order_details" data-hook>
2
2
  <div class="clear"></div>
3
- <legend align="center"><%= Spree.t(:confirm) %></legend>
3
+ <legend align="center"><%= Spree.t(@order.state, :scope => :order_state).titleize %></legend>
4
4
  <%= render :partial => 'spree/shared/order_details', :locals => { :order => @order } %>
5
5
  </fieldset>
6
6
 
@@ -17,11 +17,11 @@
17
17
  </tbody>
18
18
  <tr data-hook="order_total">
19
19
  <td><strong><%= Spree.t(:order_total) %>:</strong></td>
20
- <td><strong><span id='summary-order-total'><%= order.display_total.to_html %></span></strong></td>
20
+ <td><strong><span id='summary-order-total'><%= @order.display_total.to_html %></span></strong></td>
21
21
  </tr>
22
22
  <% if order.line_item_adjustment_totals.present? %>
23
23
  <tbody id="price-adjustments" data-hook="order_details_price_adjustments">
24
- <% order.line_item_adjustment_totals.each do |label, total| %>
24
+ <% @order.line_item_adjustment_totals.each do |label, total| %>
25
25
  <tr class="total">
26
26
  <td><strong><%= label %></strong></td>
27
27
  <td><strong><span><%= total.to_html %></span></strong></td>
@@ -26,7 +26,3 @@
26
26
  </div>
27
27
 
28
28
  </div>
29
-
30
- <% if I18n.locale != :en %>
31
- <script src='/assets/jquery.validate/localization/messages_<%= I18n.locale %>.js'></script>
32
- <% end %>
@@ -14,13 +14,15 @@
14
14
  </p>
15
15
  <p class="field" data-hook="card_expiration">
16
16
  <%= label_tag "card_month", Spree.t(:expiration) %><span class="required">*</span><br />
17
- <%= select_month(Date.today, { :prefix => param_prefix, :field_name => 'month', :use_month_numbers => true }, :class => 'required', :id => "card_month") %>
18
- <%= select_year(Date.today, { :prefix => param_prefix, :field_name => 'year', :start_year => Date.today.year, :end_year => Date.today.year + 15 }, :class => 'required', :id => "card_year") %>
17
+ <%= text_field_tag "#{param_prefix}[expiry]", '', :id => 'card_expiry', :class => "required", :placeholder => "MM / YY" %>
19
18
  </p>
20
19
  <p class="field" data-hook="card_code">
21
20
  <%= label_tag "card_code", Spree.t(:card_code) %><span class="required">*</span><br />
22
21
  <%= text_field_tag "#{param_prefix}[verification_value]", '', options_hash.merge(:id => 'card_code', :class => 'required', :size => 5) %>
23
22
  <%= link_to "(#{Spree.t(:what_is_this)})", spree.content_path('cvv'), :target => '_blank', "data-hook" => "cvv_link", :id => "cvv_link" %>
24
23
  </p>
24
+
25
+ <%= hidden_field_tag "#{param_prefix}[cc_type]", '', :id => "cc_type" %>
26
+
25
27
  <%= hidden_field param_prefix, 'first_name', :value => @order.billing_firstname %>
26
28
  <%= hidden_field param_prefix, 'last_name', :value => @order.billing_lastname %>
@@ -0,0 +1,20 @@
1
+ <%= render :partial => 'spree/shared/error_messages', :locals => { :target => @user } %>
2
+ <h1><%= Spree.t(:registration) %></h1>
3
+ <div id="registration" data-hook>
4
+ <div id="account" class="columns alpha eight">
5
+ <!-- TODO: add partial with registration form -->
6
+ </div>
7
+ <% if Spree::Config[:allow_guest_checkout] %>
8
+ <div id="guest_checkout" data-hook class="columns omega eight">
9
+ <%= render :partial => 'spree/shared/error_messages', :locals => { :target => @order } %>
10
+ <h6><%= Spree.t(:guest_user_account) %></h6>
11
+ <%= form_for @order, :url => update_checkout_registration_path, :method => :put, :html => { :id => 'checkout_form_registration' } do |f| %>
12
+ <p>
13
+ <%= f.label :email, Spree.t(:email) %><br />
14
+ <%= f.email_field :email, :class => 'title' %>
15
+ </p>
16
+ <p><%= f.submit Spree.t(:continue), :class => 'button primary' %></p>
17
+ <% end %>
18
+ </div>
19
+ <% end %>
20
+ </div>
@@ -19,11 +19,13 @@
19
19
 
20
20
  <%= render :partial => 'spree/shared/sidebar' if content_for? :sidebar %>
21
21
 
22
- <div id="content" class="columns <%= !content_for?(:sidebar) ? "sixteen" : "twelve omega" %>" data-hook>
22
+ <div id="content" class="columns <%= !content_for?(:sidebar) ? "sixteen" : "twelve" %>" data-hook>
23
23
  <%= flash_messages %>
24
24
  <%= yield %>
25
25
  </div>
26
26
 
27
+ <%= yield :templates %>
28
+
27
29
  </div>
28
30
 
29
31
  <%= render :partial => 'spree/shared/footer' %>
@@ -9,15 +9,15 @@
9
9
  <% end %>
10
10
  </td>
11
11
  <td class="cart-item-description" data-hook="cart_item_description">
12
- <h4><%= link_to line_item.name, product_path(variant.product) %></h4>
12
+ <h4><%= link_to variant.product.name, product_path(variant.product) %></h4>
13
13
  <%= variant.options_text %>
14
- <% if line_item.insufficient_stock? %>
14
+ <% if @order.insufficient_stock_lines.include? line_item %>
15
15
  <span class="out-of-stock">
16
16
  <%= Spree.t(:out_of_stock) %>&nbsp;&nbsp;<br />
17
17
  </span>
18
18
  <% end %>
19
19
  <span class="line-item-description" data-hook="line_item_description">
20
- <%= line_item_description_text(line_item.description) %>
20
+ <%= line_item_description(variant) %>
21
21
  </span>
22
22
  </td>
23
23
  <td class="cart-item-price" data-hook="cart_item_price">
@@ -0,0 +1,9 @@
1
+ <% @body_id = 'cart' %>
2
+
3
+ <h1><%= Spree.t(:shopping_cart) %></h1>
4
+
5
+ <%= form_for @order, :url =>'#', :method => :put do |order_form| %>
6
+ <%= render :partial => 'form', :locals => { :order_form => order_form } %>
7
+ <% end %>
8
+
9
+ <p><%= link_to Spree.t(:continue_shopping), products_path %></p>
@@ -7,7 +7,7 @@
7
7
  <ul>
8
8
  <% @product.variants_and_option_values(current_currency).each_with_index do |variant, index| %>
9
9
  <li>
10
- <%= radio_button_tag "products[#{@product.id}]", variant.id, index == 0, 'data-price' => variant.price_in(current_currency).money %>
10
+ <%= radio_button_tag "products[#{@product.id}]", variant.id, index == 0, 'data-price' => variant.price_in(current_currency).display_price %>
11
11
  <label for="<%= ['products', @product.id, variant.id].join('_') %>">
12
12
  <span class="variant-description">
13
13
  <%= variant_options variant %>
@@ -24,7 +24,7 @@
24
24
 
25
25
  <% if @product.price_in(current_currency) and !@product.price.nil? %>
26
26
  <div data-hook="product_price" class="columns five <% if !@product.has_variants? %> alpha <% else %> omega <% end %>">
27
-
27
+
28
28
  <div id="product-price">
29
29
  <h6 class="product-section-title"><%= Spree.t(:price) %></h6>
30
30
  <div>
@@ -33,6 +33,10 @@
33
33
  </span>
34
34
  <span itemprop="priceCurrency" content="<%= @product.currency %>"></span>
35
35
  </div>
36
+
37
+ <% if @product.master.in_stock? %>
38
+ <link itemprop="availability" href="http://schema.org/InStock" />
39
+ <% end %>
36
40
  </div>
37
41
 
38
42
  <div class="add-to-cart">
@@ -48,6 +52,6 @@
48
52
  <br>
49
53
  <div><span class="price selling" itemprop="price"><%= Spree.t('product_not_available_in_this_currency') %></span></div>
50
54
  </div>
51
- <% end %>
55
+ <% end %>
52
56
  </div>
53
57
  <% end %>
@@ -1,5 +1,5 @@
1
- <% if image %>
1
+ <% if defined?(image) && image %>
2
2
  <%= image_tag image.attachment.url(:product), :itemprop => "image" %>
3
3
  <% else %>
4
4
  <%= product_image(@product, :itemprop => "image") %>
5
- <% end %>
5
+ <% end %>
@@ -1,39 +1,35 @@
1
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');
2
7
 
3
- <%= javascript_tag do %>
4
- var _gaq = _gaq || [];
5
- _gaq.push(['_setAccount', '<%= tracker.analytics_id %>']);
6
- _gaq.push(['_trackPageview']);
8
+ ga('create', '<%= tracker.analytics_id %>');
9
+ ga('send', 'pageview');
7
10
 
8
11
  <% if flash[:commerce_tracking] && @order.present? %>
9
- <%# more info: https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiEcommerce %>
10
- _gaq.push(['_addTrans',
11
- "<%= j @order.number %>",
12
- "",
13
- "<%= @order.total %>",
14
- "<%= @order.adjustments.tax.sum(:amount) %>",
15
- "<%= @order.adjustments.shipping.sum(:amount) %>",
16
- "<%= j @order.bill_address.city %>",
17
- "<%= j @order.bill_address.state_text %>",
18
- "<%= j @order.bill_address.country.name %>"
19
- ]);
12
+ <%# more info: https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce %>
13
+ ga('require', 'ecommerce', 'ecommerce.js');
14
+ ga('ecommerce:addTransaction', {
15
+ 'id': '<%= j @order.number %>', // Transaction ID. Required.
16
+ 'affiliation': '<%= Spree::Config[:site_name] %>', // Affiliation or store name.
17
+ 'revenue': '<%= @order.total %>', // Grand Total.
18
+ 'shipping': '<%= @order.adjustments.shipping.sum(:amount) %>', // Shipping.
19
+ 'tax': '<%= @order.adjustments.tax.sum(:amount) %>', // Tax.
20
+ 'currencyCode': '<%= current_currency %>' // local currency code.
21
+ });
20
22
  <% @order.line_items.each do |line_item| %>
21
- _gaq.push(['_addItem',
22
- "<%= j @order.number %>",
23
- "<%= j line_item.variant.sku %>",
24
- "<%= j line_item.variant.product.name %>",
25
- "",
26
- "<%= line_item.price %>",
27
- "<%= line_item.quantity %>"
28
- ]);
23
+ ga('ecommerce:addItem', {
24
+ 'id': '<%= j @order.number %>', // Transaction ID. Required.
25
+ 'name': '<%= j line_item.variant.product.name %>', // Product name. Required.
26
+ 'sku': '<%= j line_item.variant.sku %>', // SKU/code.
27
+ 'category': '', // Category or variation.
28
+ 'price': '<%= line_item.price %>', // Unit price.
29
+ 'quantity': '<%= line_item.quantity %>' // Quantity.
30
+ });
29
31
  <% end %>
30
- _gaq.push(['_trackTrans']);
32
+ ga('ecommerce:send');
31
33
  <% end %>
32
-
33
- (function() {
34
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
35
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
36
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
37
- })();
38
- <% end %>
34
+ </script>
39
35
  <% end %>
@@ -2,13 +2,6 @@
2
2
  paginated_products = @searcher.retrieve_products if params.key?(:keywords)
3
3
  paginated_products ||= products
4
4
  %>
5
-
6
- <% content_for :head do %>
7
- <% if paginated_products.respond_to?(:num_pages) %>
8
- <%= rel_next_prev_link_tags paginated_products %>
9
- <% end %>
10
- <% end %>
11
-
12
5
  <% if products.empty? %>
13
6
  <%= Spree.t(:no_products_found) %>
14
7
  <% elsif params.key?(:keywords) %>
@@ -3,7 +3,7 @@
3
3
  <%= select_tag :taxon,
4
4
  options_for_select([[Spree.t(:all_departments), '']] +
5
5
  @taxons.map {|t| [t.name, t.id]},
6
- @taxon ? @taxon.id : params[:taxon]), 'aria-label' => 'Taxon' %>
6
+ @taxon ? @taxon.id : params[:taxon]) %>
7
7
  <%= search_field_tag :keywords, params[:keywords], :placeholder => Spree.t(:search) %>
8
8
  <%= submit_tag Spree.t(:search), :name => nil %>
9
9
  <% end %>
data/config/routes.rb CHANGED
@@ -4,13 +4,10 @@ Spree::Core::Engine.routes.draw do
4
4
 
5
5
  resources :products
6
6
 
7
- match '/locale/set', :to => 'locale#set'
8
-
9
- resources :states, :only => :index
10
- resources :countries, :only => :index
7
+ get '/locale/set', :to => 'locale#set'
11
8
 
12
9
  # non-restful checkout stuff
13
- put '/checkout/update/:state', :to => 'checkout#update', :as => :update_checkout
10
+ patch '/checkout/update/:state', :to => 'checkout#update', :as => :update_checkout
14
11
  get '/checkout/:state', :to => 'checkout#edit', :as => :checkout_state
15
12
  get '/checkout', :to => 'checkout#edit' , :as => :checkout
16
13
 
@@ -20,20 +17,20 @@ Spree::Core::Engine.routes.draw do
20
17
  end
21
18
 
22
19
  get '/orders/populate', :via => :get, :to => populate_redirect
23
- match '/orders/:id/token/:token' => 'orders#show', :via => :get, :as => :token_order
20
+ get '/orders/:id/token/:token' => 'orders#show', :as => :token_order
24
21
 
25
- resources :orders, :except => [:new, :create] do
22
+ resources :orders do
26
23
  post :populate, :on => :collection
27
24
  end
28
25
 
29
26
  get '/cart', :to => 'orders#edit', :as => :cart
30
- put '/cart', :to => 'orders#update', :as => :update_cart
27
+ patch '/cart', :to => 'orders#update', :as => :update_cart
31
28
  put '/cart/empty', :to => 'orders#empty', :as => :empty_cart
32
29
 
33
30
  # route globbing for pretty nested taxon and product paths
34
- match '/t/*id', :to => 'taxons#show', :as => :nested_taxons
31
+ get '/t/*id', :to => 'taxons#show', :as => :nested_taxons
35
32
 
36
- match '/unauthorized', :to => 'home#unauthorized', :as => :unauthorized
37
- match '/content/cvv', :to => 'content#cvv', :as => :cvv
38
- match '/content/*path', :to => 'content#show', :via => :get, :as => :content
33
+ get '/unauthorized', :to => 'home#unauthorized', :as => :unauthorized
34
+ get '/content/cvv', :to => 'content#cvv', :as => :cvv
35
+ get '/content/*path', :to => 'content#show', :as => :content
39
36
  end
@@ -0,0 +1,25 @@
1
+ module Spree
2
+ class OldPrefs < ActiveRecord::Base
3
+ self.table_name = "spree_preferences"
4
+ belongs_to :owner, :polymorphic => true
5
+ attr_accessor :owner_klass
6
+ end
7
+
8
+ class PreferenceRescue
9
+ def self.try
10
+ OldPrefs.where(:key => nil).each do |old_pref|
11
+ next unless owner = (old_pref.owner rescue nil)
12
+ unless old_pref.owner_type == "Spree::Activator" || old_pref.owner_type == "Spree::Configuration"
13
+ begin
14
+ old_pref.key = [owner.class.name, old_pref.name, owner.id].join('::').underscore
15
+ old_pref.value_type = owner.preference_type(old_pref.name)
16
+ puts "Migrating Preference: #{old_pref.key}"
17
+ old_pref.save
18
+ rescue NoMethodError => ex
19
+ puts ex.message
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
metadata CHANGED
@@ -1,141 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_frontend
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.13
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-20 00:00:00.000000000 Z
11
+ date: 2013-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: spree_core
14
+ name: spree_api
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.13
19
+ version: 2.1.0
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.13
26
+ version: 2.1.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: spree_api
28
+ name: spree_core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 2.0.13
33
+ version: 2.1.0
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.13
41
- - !ruby/object:Gem::Dependency
42
- name: jquery-rails
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: 3.0.0
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: 3.0.0
55
- - !ruby/object:Gem::Dependency
56
- name: rails
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 3.2.13
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: 3.2.13
40
+ version: 2.1.0
69
41
  - !ruby/object:Gem::Dependency
70
42
  name: canonical-rails
71
43
  requirement: !ruby/object:Gem::Requirement
72
44
  requirements:
73
- - - ">="
45
+ - - '>='
74
46
  - !ruby/object:Gem::Version
75
47
  version: '0'
76
48
  type: :runtime
77
49
  prerelease: false
78
50
  version_requirements: !ruby/object:Gem::Requirement
79
51
  requirements:
80
- - - ">="
52
+ - - '>='
81
53
  - !ruby/object:Gem::Version
82
54
  version: '0'
83
55
  - !ruby/object:Gem::Dependency
84
- name: deface
56
+ name: jquery-rails
85
57
  requirement: !ruby/object:Gem::Requirement
86
58
  requirements:
87
- - - ">="
59
+ - - ~>
88
60
  - !ruby/object:Gem::Version
89
- version: 0.9.0
61
+ version: 3.0.0
90
62
  type: :runtime
91
63
  prerelease: false
92
64
  version_requirements: !ruby/object:Gem::Requirement
93
65
  requirements:
94
- - - ">="
66
+ - - ~>
95
67
  - !ruby/object:Gem::Version
96
- version: 0.9.0
68
+ version: 3.0.0
97
69
  - !ruby/object:Gem::Dependency
98
70
  name: stringex
99
71
  requirement: !ruby/object:Gem::Requirement
100
72
  requirements:
101
- - - "~>"
73
+ - - ~>
102
74
  - !ruby/object:Gem::Version
103
75
  version: 1.5.1
104
76
  type: :runtime
105
77
  prerelease: false
106
78
  version_requirements: !ruby/object:Gem::Requirement
107
79
  requirements:
108
- - - "~>"
80
+ - - ~>
109
81
  - !ruby/object:Gem::Version
110
82
  version: 1.5.1
111
83
  - !ruby/object:Gem::Dependency
112
84
  name: email_spec
113
85
  requirement: !ruby/object:Gem::Requirement
114
86
  requirements:
115
- - - "~>"
87
+ - - ~>
116
88
  - !ruby/object:Gem::Version
117
89
  version: 1.2.1
118
90
  type: :development
119
91
  prerelease: false
120
92
  version_requirements: !ruby/object:Gem::Requirement
121
93
  requirements:
122
- - - "~>"
94
+ - - ~>
123
95
  - !ruby/object:Gem::Version
124
96
  version: 1.2.1
125
- - !ruby/object:Gem::Dependency
126
- name: capybara-accessible
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - '='
130
- - !ruby/object:Gem::Version
131
- version: 0.2.0
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - '='
137
- - !ruby/object:Gem::Version
138
- version: 0.2.0
139
97
  description: Required dependency for Spree
140
98
  email: sean@spreecommerce.com
141
99
  executables: []
@@ -144,7 +102,6 @@ extra_rdoc_files: []
144
102
  files:
145
103
  - LICENSE
146
104
  - README.md
147
- - app/assets/images/admin/bg/spree_50.png
148
105
  - app/assets/images/credit_cards/amex_cid.gif
149
106
  - app/assets/images/credit_cards/credit_card.gif
150
107
  - app/assets/images/credit_cards/discover_cid.gif
@@ -200,6 +157,7 @@ files:
200
157
  - app/views/spree/checkout/edit.html.erb
201
158
  - app/views/spree/checkout/payment/_check.html.erb
202
159
  - app/views/spree/checkout/payment/_gateway.html.erb
160
+ - app/views/spree/checkout/registration.html.erb
203
161
  - app/views/spree/content/cvv.html.erb
204
162
  - app/views/spree/home/index.html.erb
205
163
  - app/views/spree/layouts/spree_application.html.erb
@@ -207,6 +165,7 @@ files:
207
165
  - app/views/spree/orders/_form.html.erb
208
166
  - app/views/spree/orders/_line_item.html.erb
209
167
  - app/views/spree/orders/edit.html.erb
168
+ - app/views/spree/orders/new.html.erb
210
169
  - app/views/spree/orders/show.html.erb
211
170
  - app/views/spree/products/_cart_form.html.erb
212
171
  - app/views/spree/products/_image.html.erb
@@ -238,9 +197,10 @@ files:
238
197
  - config/initializers/rails_5868.rb
239
198
  - config/initializers/spree.rb
240
199
  - config/routes.rb
241
- - lib/spree/frontend.rb
242
200
  - lib/spree/frontend/engine.rb
243
201
  - lib/spree/frontend/middleware/seo_assist.rb
202
+ - lib/spree/frontend/preference_rescue.rb
203
+ - lib/spree/frontend.rb
244
204
  - lib/spree/scopes/dynamic.rb
245
205
  - lib/spree_frontend.rb
246
206
  - lib/tasks/rake_util.rb
@@ -547,18 +507,18 @@ require_paths:
547
507
  - lib
548
508
  required_ruby_version: !ruby/object:Gem::Requirement
549
509
  requirements:
550
- - - ">="
510
+ - - '>='
551
511
  - !ruby/object:Gem::Version
552
512
  version: 1.9.3
553
513
  required_rubygems_version: !ruby/object:Gem::Requirement
554
514
  requirements:
555
- - - ">="
515
+ - - '>='
556
516
  - !ruby/object:Gem::Version
557
517
  version: '0'
558
518
  requirements:
559
519
  - none
560
520
  rubyforge_project: spree_frontend
561
- rubygems_version: 2.2.2
521
+ rubygems_version: 2.1.0
562
522
  signing_key:
563
523
  specification_version: 4
564
524
  summary: Frontend e-commerce functionality for the Spree project.