Module: CheckoutHelper

Defined in:
app/helpers/checkout_helper.rb

Instance Method Summary collapse

Instance Method Details

#checkout_progressObject

TODO: this can be deleted from extension after Spree 0.70.0 release



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/helpers/checkout_helper.rb', line 8

def checkout_progress
  states = checkout_states
  items = states.map do |state|
    text = t("order_state.#{state}").titleize

    css_classes = []
    current_index = states.index(@order.state)
    state_index = states.index(state)

    if state_index < current_index
      css_classes << 'completed'
      text = link_to text, checkout_state_path(state)
    end

    css_classes << 'next' if state_index == current_index + 1
    css_classes << 'current' if state == @order.state
    css_classes << 'first' if state_index == 0
    css_classes << 'last' if state_index == states.length - 1
    # It'd be nice to have separate classes but combining them with a dash helps out for IE6 which only sees the last class
    ('li', ('span', text), :class => css_classes.join('-'))
  end
  ('ol', raw(items.join("\n")), :class => 'progress-steps', :id => "checkout-step-#{@order.state}")
end

#checkout_statesObject



3
4
5
# File 'app/helpers/checkout_helper.rb', line 3

def checkout_states
  %w(address delivery payment confirm) 
end