spree_frontend 2.0.4 → 2.0.5

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: fed5bab32b5df9e5a3ec48e16a99c614d7c971c0
4
- data.tar.gz: c21d03116b27055df1799f54c214a675c67a0194
3
+ metadata.gz: 4648f59f227cbb4cdc23403055f4910dcc48dc61
4
+ data.tar.gz: 536af35efd794e1431a1e57255fa705e1b653719
5
5
  SHA512:
6
- metadata.gz: 3ad0f5b3b87813581495f08fa0dfdd846b4f9ca3089a021bb82cb768a42de2fe71e8c1972cedeb751c41a353ff17988972718f54a7d1d0cd33d63c15518d88da
7
- data.tar.gz: e4d13771819dcc9edb06b714abc81225071a04191b27ecbf83531e19fe65f85a2967336de82722230c697dcb22ad67628f7a6aa494deab7c5abb9fe14c769f0f
6
+ metadata.gz: 4af58cfefc3867d11eee4258766426906e37d49e5c01998835af6d01d5773c47a95903801faaa2ada1b219b252140070a21e797620e795402b767357002e7fcb
7
+ data.tar.gz: ae39a90aad057acc766b596e27001b197201248df68db24dcdd8f03632621877172c83011035a54ce9df6087f17dcca6e858d917b5e270a2fcfd98e454bdbb53
@@ -17,6 +17,8 @@ module Spree
17
17
  before_filter :check_authorization
18
18
  before_filter :apply_coupon_code
19
19
 
20
+ before_filter :setup_for_current_state
21
+
20
22
  helper 'spree/orders'
21
23
 
22
24
  rescue_from Spree::Core::GatewayError, :with => :rescue_from_spree_gateway_error
@@ -27,7 +29,7 @@ module Spree
27
29
  fire_event('spree.checkout.update')
28
30
 
29
31
  unless @order.next
30
- flash[:error] = @order.errors[:base].join("\n")
32
+ flash[:error] = @order.errors.full_messages.join("\n")
31
33
  redirect_to checkout_state_path(@order.state) and return
32
34
  end
33
35
 
@@ -69,7 +71,6 @@ module Spree
69
71
  redirect_to checkout_state_path(@order.state) if @order.can_go_to_state?(params[:state]) && !skip_state_validation?
70
72
  @order.state = params[:state]
71
73
  end
72
- setup_for_current_state
73
74
  end
74
75
 
75
76
  def ensure_checkout_allowed
@@ -120,9 +121,14 @@ module Spree
120
121
  send(method_name) if respond_to?(method_name, true)
121
122
  end
122
123
 
124
+ # Skip setting ship address if order doesn't have a delivery checkout step
125
+ # to avoid triggering validations on shipping address
123
126
  def before_address
124
127
  @order.bill_address ||= Address.default
125
- @order.ship_address ||= Address.default
128
+
129
+ if @order.checkout_steps.include? "delivery"
130
+ @order.ship_address ||= Address.default
131
+ end
126
132
  end
127
133
 
128
134
  def before_delivery
@@ -21,7 +21,7 @@ module Spree
21
21
 
22
22
  if @order.update_attributes(params[:order])
23
23
  @order.line_items = @order.line_items.select {|li| li.quantity > 0 }
24
- @order.create_proposed_shipments if @order.shipments.any?
24
+ @order.ensure_updated_shipments
25
25
  return if after_update_attributes
26
26
 
27
27
  fire_event('spree.order.contents_changed')
@@ -51,7 +51,7 @@ module Spree
51
51
  def populate
52
52
  populator = Spree::OrderPopulator.new(current_order(true), current_currency)
53
53
  if populator.populate(params.slice(:products, :variants, :quantity))
54
- current_order.create_proposed_shipments if current_order.shipments.any?
54
+ current_order.ensure_updated_shipments
55
55
 
56
56
  fire_event('spree.cart.add')
57
57
  fire_event('spree.order.contents_changed')
@@ -18,10 +18,10 @@
18
18
  <col style="width: 20%;" />
19
19
  </colgroup>
20
20
  <thead>
21
- <th>image</th>
22
- <th>name</th>
23
- <th>quantity</th>
24
- <th>price</th>
21
+ <th></th>
22
+ <th align='left'><%= Spree.t(:item) %></th>
23
+ <th><%= Spree.t(:qty) %></th>
24
+ <th><%= Spree.t(:price) %></th>
25
25
  </thead>
26
26
  <tbody>
27
27
  <% ship_form.object.manifest.each do |item| %>
@@ -64,10 +64,10 @@
64
64
  <col style="width: 20%;" />
65
65
  </colgroup>
66
66
  <thead>
67
- <th>image</th>
68
- <th>name</th>
69
- <th>quantity</th>
70
- <th>price</th>
67
+ <th></th>
68
+ <th align='left'><%= Spree.t(:item) %></th>
69
+ <th><%= Spree.t(:qty) %></th>
70
+ <th><%= Spree.t(:price) %></th>
71
71
  </thead>
72
72
  <tbody>
73
73
  <% @differentiator.missing.each do |variant, quantity| %>
@@ -19,9 +19,9 @@
19
19
  <td><strong><%= Spree.t(:order_total) %>:</strong></td>
20
20
  <td><strong><span id='summary-order-total'><%= @order.display_total.to_html %></span></strong></td>
21
21
  </tr>
22
- <% if order.price_adjustment_totals.present? %>
22
+ <% if order.line_item_adjustment_totals.present? %>
23
23
  <tbody id="price-adjustments" data-hook="order_details_price_adjustments">
24
- <% @order.price_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>
@@ -10,9 +10,7 @@
10
10
  </tr>
11
11
  </thead>
12
12
  <tbody id="line_items" data-hook>
13
- <%= order_form.fields_for :line_items do |item_form| %>
14
- <%= render :partial => 'line_item', :locals => { :variant => item_form.object.variant, :line_item => item_form.object, :item_form => item_form } %>
15
- <% end %>
13
+ <%= render partial: 'line_item', collection: order_form.object.line_items, locals: {order_form: order_form} %>
16
14
  </tbody>
17
15
  <%= render "spree/orders/adjustments" unless @order.adjustments.eligible.blank? %>
18
16
  </table>
@@ -1,31 +1,36 @@
1
- <tr class="<%= cycle('', 'alt') %> line-item">
2
- <td class="cart-item-image" data-hook="cart_item_image">
3
- <% if variant.images.length == 0 %>
4
- <%= link_to small_image(variant.product), variant.product %>
5
- <% else %>
6
- <%= link_to image_tag(variant.images.first.attachment.url(:small)), variant.product %>
7
- <% end %>
8
- </td>
9
- <td class="cart-item-description" data-hook="cart_item_description">
10
- <h4><%= link_to variant.product.name, product_path(variant.product) %></h4>
11
- <%= variant.options_text %>
12
- <% if @order.insufficient_stock_lines.include? line_item %>
13
- <span class="out-of-stock">
14
- <%= Spree.t(:out_of_stock) %>&nbsp;&nbsp;<br />
1
+ <% variant = line_item.variant -%>
2
+ <%= order_form.fields_for :line_items, line_item do |item_form| -%>
3
+ <tr class="<%= cycle('', 'alt') %> line-item">
4
+ <td class="cart-item-image" data-hook="cart_item_image">
5
+ <% if variant.images.length == 0 %>
6
+ <%= link_to small_image(variant.product), variant.product %>
7
+ <% else %>
8
+ <%= link_to image_tag(variant.images.first.attachment.url(:small)), variant.product %>
9
+ <% end %>
10
+ </td>
11
+ <td class="cart-item-description" data-hook="cart_item_description">
12
+ <h4><%= link_to variant.product.name, product_path(variant.product) %></h4>
13
+ <%= variant.options_text %>
14
+ <% if @order.insufficient_stock_lines.include? line_item %>
15
+ <span class="out-of-stock">
16
+ <%= Spree.t(:out_of_stock) %>&nbsp;&nbsp;<br />
17
+ </span>
18
+ <% end %>
19
+ <span class="line-item-description" data-hook="line_item_description">
20
+ <%= line_item_description(variant) %>
15
21
  </span>
16
- <% end %>
17
- <%= line_item_description(variant) %>
18
- </td>
19
- <td class="cart-item-price" data-hook="cart_item_price">
20
- <%= line_item.single_money.to_html %>
21
- </td>
22
- <td class="cart-item-quantity" data-hook="cart_item_quantity">
23
- <%= item_form.number_field :quantity, :min => 0, :class => "line_item_quantity", :size => 5 %>
24
- </td>
25
- <td class="cart-item-total" data-hook="cart_item_total">
26
- <%= line_item.display_amount.to_html unless line_item.quantity.nil? %>
27
- </td>
28
- <td class="cart-item-delete" data-hook="cart_item_delete">
29
- <%= link_to image_tag('icons/delete.png'), '#', :class => 'delete', :id => "delete_#{dom_id(line_item)}" %>
30
- </td>
31
- </tr>
22
+ </td>
23
+ <td class="cart-item-price" data-hook="cart_item_price">
24
+ <%= line_item.single_money.to_html %>
25
+ </td>
26
+ <td class="cart-item-quantity" data-hook="cart_item_quantity">
27
+ <%= item_form.number_field :quantity, :min => 0, :class => "line_item_quantity", :size => 5 %>
28
+ </td>
29
+ <td class="cart-item-total" data-hook="cart_item_total">
30
+ <%= line_item.display_amount.to_html unless line_item.quantity.nil? %>
31
+ </td>
32
+ <td class="cart-item-delete" data-hook="cart_item_delete">
33
+ <%= link_to image_tag('icons/delete.png'), '#', :class => 'delete', :id => "delete_#{dom_id(line_item)}" %>
34
+ </td>
35
+ </tr>
36
+ <% end -%>
@@ -1,10 +1,13 @@
1
1
  <div class="row steps-data">
2
2
 
3
3
  <% if order.has_step?("address") %>
4
- <div class="columns alpha four" data-hook="order-ship-address">
5
- <h6><%= Spree.t(:shipping_address) %> <%= link_to "(#{Spree.t(:edit)})", checkout_state_path(:address) unless @order.completed? %></h6>
6
- <%= render :partial => 'spree/shared/address', :locals => { :address => order.ship_address } %>
7
- </div>
4
+
5
+ <% if order.has_step?("delivery") %>
6
+ <div class="columns alpha four" data-hook="order-ship-address">
7
+ <h6><%= Spree.t(:shipping_address) %> <%= link_to "(#{Spree.t(:edit)})", checkout_state_path(:address) unless @order.completed? %></h6>
8
+ <%= render :partial => 'spree/shared/address', :locals => { :address => order.ship_address } %>
9
+ </div>
10
+ <% end %>
8
11
 
9
12
  <div class="columns alpha four" data-hook="order-bill-address">
10
13
  <h6><%= Spree.t(:billing_address) %> <%= link_to "(#{Spree.t(:edit)})", checkout_state_path(:address) unless @order.completed? %></h6>
@@ -82,9 +85,9 @@
82
85
  <td class="total"><span id="order_total"><%= @order.display_total.to_html %></span></td>
83
86
  </tr>
84
87
  </tfoot>
85
- <% if order.price_adjustment_totals.present? %>
88
+ <% if order.line_item_adjustment_totals.present? %>
86
89
  <tfoot id="price-adjustments" data-hook="order_details_price_adjustments">
87
- <% @order.price_adjustment_totals.each do |key, total| %>
90
+ <% @order.line_item_adjustment_totals.each do |key, total| %>
88
91
  <tr class="total">
89
92
  <td colspan="4"><strong><%= key %></strong></td>
90
93
  <td class="total"><span><%= total %></span></td>
@@ -2,5 +2,3 @@ require 'mail'
2
2
 
3
3
  # Spree Configuration
4
4
  SESSION_KEY = '_spree_session_id'
5
-
6
- LIKE = ActiveRecord::Base.connection.adapter_name == 'PostgreSQL' ? 'ILIKE' : 'LIKE'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_frontend
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-05 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
14
  name: spree_core
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.4
19
+ version: 2.0.5
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.4
26
+ version: 2.0.5
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: spree_api
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 2.0.4
33
+ version: 2.0.5
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.4
40
+ version: 2.0.5
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: jquery-rails
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -547,7 +547,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
547
547
  requirements:
548
548
  - none
549
549
  rubyforge_project: spree_frontend
550
- rubygems_version: 2.0.0
550
+ rubygems_version: 2.1.0
551
551
  signing_key:
552
552
  specification_version: 4
553
553
  summary: Frontend e-commerce functionality for the Spree project.