Created
July 26, 2011 08:21
-
-
Save sshaw/1106265 to your computer and use it in GitHub Desktop.
FormBuilderWithCancel < Formtastic::SemanticFormBuilder
This file contains hidden or 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
# - 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