Skip to content

Instantly share code, notes, and snippets.

@fedesoria
Created October 14, 2011 23:40
Show Gist options
  • Save fedesoria/1288694 to your computer and use it in GitHub Desktop.
Save fedesoria/1288694 to your computer and use it in GitHub Desktop.
Custom input for simple_form using twitter bootstrap
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
<%= 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