Formulate
Rails form builder with flexible markup and styles.
Formulate consists of a custom form builder, which builds on top of the default form builder in Rails, and a Sass stylesheet to provide some level of stylistic normalization.
Haml Requirement
Formulate's FormBuilder
relies on some helper methods provided by Haml, so
it will only work when used within Haml templates.
Installation
Add this line to your application's Gemfile
:
gem 'formulate'
And then execute:
$ bundle
Or install it yourself as:
$ gem install formulate
Usage
Formulate provides a helper module to be included in your Rails controllers.
You can also load the helper in your ApplicationController
to use it across
your entire app.
class ApplicationController < ActionController::Base
helper Formulate::FormHelper
end
Formulate doesn't clobber any of the built-in form builder methods, so your forms should continue to work without modification, giving you the ability to selectively begin using Formulate in your applications where you see fit.
Styles
If you'd like to use Formulate's stylesheet, you'll need to import it into a
Sass file like app/assets/stylesheets/forms.css.sass
:
@import formulate
Formulate's styles are all scoped under the selector form.formulate
, so they
shouldn't clobber anything in your own applications. Basically, this just loads
a stripped down version of normalize.css with only the parts relevant to
forms. It also specifies a handful of styles to improve the vertical rhythm of
the elements generated by the form builder.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Copyright
Copyright © 2012 Tyler Hunt. See LICENSE for details.