Sha256: bac3ccf54813d532eacfa0bb1b89082562e9a1a0910169e36d19b33e17796336

Contents?: true

Size: 1.25 KB

Versions: 18

Compression:

Stored size: 1.25 KB

Contents

module Spree
  module CheckoutHelper
    def checkout_states
      if @order.payment and @order.payment.payment_method.payment_profiles_supported?
        %w(address delivery payment confirm complete)
      else
        %w(address delivery payment complete)
      end
    end

    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
        content_tag('li', content_tag('span', text), :class => css_classes.join('-'))
      end
      content_tag('ol', raw(items.join("\n")), :class => 'progress-steps', :id => "checkout-step-#{@order.state}")
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
spree_core-1.0.7 app/helpers/spree/checkout_helper.rb
spree_core-1.1.3 app/helpers/spree/checkout_helper.rb
spree_core-1.0.6 app/helpers/spree/checkout_helper.rb
spree_core-1.1.2 app/helpers/spree/checkout_helper.rb
spree_core-1.1.2.rc1 app/helpers/spree/checkout_helper.rb
spree_core-1.1.1 app/helpers/spree/checkout_helper.rb
spree_core-1.1.0 app/helpers/spree/checkout_helper.rb
spree_core-1.0.4 app/helpers/spree/checkout_helper.rb
spree_core-1.1.0.rc2 app/helpers/spree/checkout_helper.rb
spree_core-1.1.0.rc1 app/helpers/spree/checkout_helper.rb
spree_core-1.0.3 app/helpers/spree/checkout_helper.rb
spree_core-1.0.2 app/helpers/spree/checkout_helper.rb
spree_core-1.0.1 app/helpers/spree/checkout_helper.rb
spree_core-1.0.0 app/helpers/spree/checkout_helper.rb
spree_core-1.0.0.rc4 app/helpers/spree/checkout_helper.rb
spree_core-1.0.0.rc3 app/helpers/spree/checkout_helper.rb
spree_core-1.0.0.rc2 app/helpers/spree/checkout_helper.rb
spree_core-1.0.0.rc1 app/helpers/spree/checkout_helper.rb