A website template with lots of features, built with ruby on rails.

simple_form_bootstrap.rb 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # Use this setup block to configure all options available in SimpleForm.
  2. SimpleForm.setup do |config|
  3. config.wrappers :bootstrap, tag: 'div', class: 'control-group', error_class: 'error' do |b|
  4. b.use :html5
  5. b.use :placeholder
  6. b.use :label
  7. b.wrapper tag: 'div', class: 'controls' do |ba|
  8. ba.use :input
  9. ba.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
  10. ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' }
  11. end
  12. end
  13. config.wrappers :prepend, tag: 'div', class: "control-group", error_class: 'error' do |b|
  14. b.use :html5
  15. b.use :placeholder
  16. b.use :label
  17. b.wrapper tag: 'div', class: 'controls' do |input|
  18. input.wrapper tag: 'div', class: 'input-prepend' do |prepend|
  19. prepend.use :input
  20. end
  21. input.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
  22. input.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
  23. end
  24. end
  25. config.wrappers :append, tag: 'div', class: "control-group", error_class: 'error' do |b|
  26. b.use :html5
  27. b.use :placeholder
  28. b.use :label
  29. b.wrapper tag: 'div', class: 'controls' do |input|
  30. input.wrapper tag: 'div', class: 'input-append' do |append|
  31. append.use :input
  32. end
  33. input.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
  34. input.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
  35. end
  36. end
  37. # Wrappers for forms and inputs using the Twitter Bootstrap toolkit.
  38. # Check the Bootstrap docs (http://twitter.github.com/bootstrap)
  39. # to learn about the different styles for forms and inputs,
  40. # buttons and other elements.
  41. config.default_wrapper = :bootstrap
  42. end