Created
September 27, 2013 19:10
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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