Skip to content

Instantly share code, notes, and snippets.

@sshaw
Created July 26, 2011 08:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sshaw/1106265 to your computer and use it in GitHub Desktop.
Save sshaw/1106265 to your computer and use it in GitHub Desktop.
FormBuilderWithCancel < Formtastic::SemanticFormBuilder
# - f.buttons do
# = f.commit_button
# = f.cancel
# Need to make this v2 like by using module...
class FormBuilderWithCancel < Formtastic::SemanticFormBuilder
def cancel(*args)
options = args.extract_options!
options[:class] ||= "cancel"
options[:label] ||= (args.shift || "Cancel")
options[:return_to] ||= :back
template.content_tag(:li, template.link_to(options[:label], options[:return_to]), :class => options[:class])
end
end
Formtastic::SemanticFormHelper.builder = FormBuilderWithCancel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment