
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
formtastic-bootstrap
Advanced tools
A Formtastic form builder that creates markup suitable for the Twitter Bootstrap framework. In theory, it should just work. Two great tastes in one!
You can follow FormBoot on twitter for update announcements and other relevant info.
This version of Formtastic Bootstrap should support the following:
Bootstrap
Rails
Formtastic
Ruby
Install the gem with
gem install formtastic-bootstrap
Or add it to your Gemfile:
gem 'formtastic-bootstrap'
And install it with bundle install.
Add the following line to your Formtastic initialization file:
# config/initializers/formtastic.rb
Formtastic::Helpers::FormHelper.builder = FormtasticBootstrap::FormBuilder
Add the following line to the top of your application.css file:
# app/assets/stylesheets/application.css
*= require formtastic-bootstrap
Make sure you've already downloaded and installed Formtastic!
THIS SECTION IS OUT OF DATE.
In general, Formtastic creates very verbose HTML whereas Bootstrap expects (ever) simpler HTML. Every attempt has been made to generate the HTML expected by Bootstrap while still generating the rich HTML provided by Formtastic. When there is a conflict, Bootstrap wins.
THIS SECTION IS OUT OF DATE
Bootstrap is somewhat incomplete, and in a few cases an inference needed to be drawn to determine a course of action. If you disagree with any of these choices, feel free to let me know.
The gem also provides some "shim" CSS where Bootstrap is missing styles provided Formtastic.
A lot of the code (especially the test suite) was copied over from Formtastic and then beaten into submission. I'm sure you'll find some ugliness in there. In general, I mimicked the Formtastic code structure as much as possible.
In particular:
Contributions are welcome!
In general, the usage should be identical to Formtastic's. Some changes have been introduced in order to support Bootstrap-specific controls.
To create a Prepended Text field, use the :prepend
option. This works on any text field input type, like :url
, :search
, and of course :string
<%= semantic_form_for @user do |f| %>
<%= f.inputs do %>
<%= f.input :handle, :prepend => '@' %>
<% end %>
<% end %>
To create an Appended Text field, use the :append
option. This works on any text field input type, like :url
, :search
, and of course :string
<%= semantic_form_for @user do |f| %>
<%= f.inputs do %>
<%= f.input :handle, :append => '%' %>
<% end %>
<% end %>
To add appended elements that are not contained within an add-on span
use the :append_content
or :prepend_content
option.
<%= semantic_form_for @user do |f| %>
<%= f.inputs do %>
<%= f.input :handle, :append_content => content_tag(:a, "Click Here", :class => 'btn') %>
<% end %>
<% end %>
A big thank you to all contributors!
If you're filing a bug, thank you! Secondly, in the report please include:
Source contributions are very welcome! Most of the recent work on this package has been done by the community.
Copyright (c) 2013-2015 Matthew Bellantoni. See LICENSE.txt for further details.
FAQs
Unknown package
We found that formtastic-bootstrap demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.