Created
October 14, 2011 23:40
-
-
Save fedesoria/1288694 to your computer and use it in GitHub Desktop.
Custom input for simple_form using twitter bootstrap
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
class PrependCheckboxInput < SimpleForm::Inputs::Base | |
def input | |
"<div class='input-prepend'> | |
<label class='add-on active' title='#{options[:tooltip]}' rel='tooltip' > | |
#{@builder.check_box(attribute_name.to_s + '_check')} | |
</label> | |
#{@builder.text_field(attribute_name, input_html_options)} | |
<span class='help-inline'> | |
#{options[:help]} | |
</span> | |
</div>".html_safe | |
end | |
end |
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
<%= f.input :name, :as => :prepend_checkbox, :tooltip => "Has name?", :help => "Please insert your name" %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment