Skip to content

Instantly share code, notes, and snippets.

@marckohlbrugge
Created September 27, 2013 19:10
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 marckohlbrugge/6733672 to your computer and use it in GitHub Desktop.
Save marckohlbrugge/6733672 to your computer and use it in GitHub Desktop.
Helper method to show current wizard progress for [Wicket](https://github.com/schneems/wicked)
def wizard_steps_list
methods = %w(past_step future_step previous_step next_step)
content_tag(:ol, { class: 'wizard_steps' }, false) do
wizard_steps.map do |wizard_step|
classes = methods.collect{ |method| method if send(method+'?', wizard_step) }.compact
classes = ['current_step'] unless classes.length > 0
concat(content_tag(:li, link_to_if(past_step?(wizard_step), wizard_step.to_s.titleize, wizard_path(wizard_step)), { class: classes.join(' ') }, false))
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment