Skip to content

Instantly share code, notes, and snippets.

@charly
Created August 4, 2009 08:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save charly/161117 to your computer and use it in GitHub Desktop.
Save charly/161117 to your computer and use it in GitHub Desktop.
module OrdersHelper
# helper to determine the active order step given :
# 1. a params[:step]
# 2. if none, according to the order's state
def active_step
@active_step ||= if params[:step]
params[:step]
elsif %(opened).include? @order.state
"1start"
elsif %(submitted).include? @order.state
"2price"
elsif %(evaluated).include? @order.state
"3bill"
elsif @order.state=="billed"
"4payment"
else
"5end"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment