Skip to content

Commit

Permalink
Merge pull request #1667 from mamhoff/deprecate_has_step_method
Browse files Browse the repository at this point in the history
Deprecate Spree::Order#has_step?
  • Loading branch information
jhawthorn committed Jan 3, 2017
2 parents 3801e35 + c676d0d commit 34a8d3c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 3 additions & 4 deletions core/app/models/spree/order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -465,9 +465,8 @@ def empty!
persist_totals
end

def has_step?(step)
checkout_steps.include?(step)
end
alias_method :has_step?, :has_checkout_step?
deprecate has_step?: :has_checkout_step?, deprecator: Spree::Deprecation

def state_changed(name)
state = "#{name}_state"
Expand Down Expand Up @@ -785,7 +784,7 @@ def require_email
end

def ensure_inventory_units
if has_step?("delivery")
if has_checkout_step?("delivery")
inventory_validator = Spree::Stock::InventoryValidator.new

errors = line_items.map { |line_item| inventory_validator.validate(line_item) }.compact
Expand Down
6 changes: 3 additions & 3 deletions frontend/app/views/spree/shared/_order_details.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<div class="row steps-data">

<% if order.has_step?("address") %>
<% if order.has_checkout_step?("address") %>

<div class="columns alpha four" data-hook="order-bill-address">
<h6><%= Spree.t(:billing_address) %> <%= link_to "(#{Spree.t('actions.edit')})", checkout_state_path(:address) unless order.completed? %></h6>
<%= render :partial => 'spree/shared/address', :locals => { :address => order.bill_address } %>
</div>

<% if order.has_step?("delivery") %>
<% if order.has_checkout_step?("delivery") %>
<div class="columns alpha four" data-hook="order-ship-address">
<h6><%= Spree.t(:shipping_address) %> <%= link_to "(#{Spree.t('actions.edit')})", checkout_state_path(:address) unless order.completed? %></h6>
<%= render :partial => 'spree/shared/address', :locals => { :address => order.ship_address } %>
Expand All @@ -28,7 +28,7 @@
<% end %>
<% end %>
<% if order.has_step?("payment") %>
<% if order.has_checkout_step?("payment") %>
<div class="columns omega four">
<h6><%= Spree.t(:payment_information) %> <%= link_to "(#{Spree.t('actions.edit')})", checkout_state_path(:payment) unless order.completed? %></h6>
<div class="payment-info">
Expand Down

0 comments on commit 34a8d3c

Please sign in to comment.