Created
March 29, 2011 22:12
-
-
Save mcmire/893456 to your computer and use it in GitHub Desktop.
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
SimpleForm::Components::Wrapper.module_eval do | |
def input_html_classes | |
[input_type, required_class] | |
end | |
def wrapper_html_options | |
input_html_classes << SimpleForm.wrapper_class | |
if options[:wrapper_class] | |
input_html_classes += options[:wrapper_class].split(" ") | |
end | |
if input_html_classes.nil? | |
raise "This will always fail even if options[:wrapper_class] == false, because input_html_classes was seen even if it wasn't set!" | |
end | |
if has_errors? | |
input_html_classes << SimpleForm.wrapper_error_class | |
if options[:wrapper_error_class] | |
input_html_classes += options[:wrapper_error_class].split(" ") | |
end | |
end | |
html_options_for(:wrapper, input_html_classes) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment