Skip to content

Integrate formtastic with standard Bootstrap markup. I no longer am working on this because I am using Simple Form with a custom initializer.

License

Notifications You must be signed in to change notification settings

HuntBurdick/formtastic-bootstrap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

formtastic-bootstrap

Integrate formtastic with standard Bootstrap markup.

Installation

  1. Make sure Formtastic and Bootstrap are properly installed.
  2. Drop the "inputs" file on top of the "app" folder.
  3. In "config/initializers" add the following line: Formtastic::FormBuilder.required_string = ""
  4. Modified inputs will now be available for use within semantic forms generated by Formtastic.

Documentation

Formtastic-bootstrap breaks out of the typical Formtastic structure. It is not recommended to wrap inputs with an 'f.inputs do'.

Example:

<%= semantic_form_for @test, :url => 'url_for_action' do |form| %>

<h2>String Inputs</h2>
<%= form.input :string, :as => :bootstrap_string %>
<%= form.input :string, :as => :bootstrap_string %>

<hr />



<h2>Text Inputs</h2>
<%= form.input :text, :as => :bootstrap_text %>
<%= form.input :text, :as => :bootstrap_text %>

<hr />



<h2>Password Inputs</h2>
<%= form.input :text, :as => :bootstrap_password %>
<%= form.input :text, :as => :bootstrap_password %>

<hr />



<h2>Checkbox Inputs</h2>
<h5>Regular Checkboxes</h5>
<hr />
<%= form.input :boolean, :as => :bootstrap_checkbox %>
<%= form.input :boolean, :as => :bootstrap_checkbox %>

<h5>Inline Checkboxes</h5>
<hr />
<%= form.input :boolean, :as => :bootstrap_inline_checkbox %>
<%= form.input :boolean, :as => :bootstrap_inline_checkbox %>
<%= form.input :boolean, :as => :bootstrap_inline_checkbox %>
<%= form.input :boolean, :as => :bootstrap_inline_checkbox %>

<hr />



<h2>Radio Inputs</h2>
<%= form.input :boolean, :as => :bootstrap_radio %>
<%= form.input :boolean, :as => :bootstrap_radio %>
<%= form.input :boolean, :as => :bootstrap_radio %>

<hr />



<h2>Select Inputs</h2>
<!-- Works Properly. Collection arrays must have an index. this will not work => ["Justin", "Kate", "Amelia", "Gus", "Meg"] -->
<%= form.input :string, :as => :bootstrap_select, :collection => [["Justin", "J"], ["Bob", "B1"], ["Joe", "joe"]] %>
<%= form.input :string, :as => :bootstrap_select, :collection => Page.all, :include_blank => true %>

<hr />

<h2>Date/Time Inputs</h2>
<p>Date Select</p>
<%= form.input :date, :as => :bootstrap_datepicker %>

<p>DateTime Select</p>
<%= form.input :datetime, :as => :bootstrap_datetimepicker %>

<p>Time Select</p>
<%= form.input :time, :as => :bootstrap_timepicker %>

<hr />

<h2>File Attachements</h2>

<% end %>

Notes

More inputs to come (Country, hidden, etc..) Only tested with Rails 4 and the latest Formtastic

About

Integrate formtastic with standard Bootstrap markup. I no longer am working on this because I am using Simple Form with a custom initializer.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages