Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save pacovell/2367235 to your computer and use it in GitHub Desktop.
Save pacovell/2367235 to your computer and use it in GitHub Desktop.
simple_form bootstrap 2.0.x :span component
module SimpleForm
module DoneComponents
module Span
def span
if options[:span]
input_html_classes << 'input-block-level'
options[:wrapper_html] ||= {}
options[:wrapper_html][:class] ||= ""
options[:wrapper_html][:class] <<= " #{options[:span]}"
end
# Return value is output directly, so return nil
nil
end
end
end
end
class SimpleForm::Inputs::Base
include SimpleForm::DoneComponents::Span
end
@pacovell
Copy link
Author

I just put this at the bottom of config/initializers/simple_form.rb and then replace

f.input :item, :wrapper_html => { :class => 'span3' }, :input_html => { :class => 'input-block-level' }

with

f.input :span => 'span2'

Works with fluid and fixed grids.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment