Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A custom builder (and some helper methods) for creating consistent and accessible forms in rails
Ruby
branch: master

This branch is 21 commits ahead, 3 commits behind glenngillen:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
app/stylesheets
config/locales/form_builder
lib
public
tasks
test
MIT-LICENSE
README
Rakefile
init.rb
install.rb
uninstall.rb

README

== Semantic Form Builder (fork by themactep)

Semantic Form Builder is a customer FormBuilder for use in Rails, aiming to
give accessible, consistent, forms with the ultimate of DRY.

No more defining labels, worrying about formatting, etc. Let the default
form_for tag take care of all the hassles for you

For an example of what it looks like check:
http://rubypond.com/articles/2008/07/16/sexy-forms-in-rails/

== Requirements

  - This plugin works better when accompanied with such goodies as
    http://github.com/cloudhead/more
    http://github.com/aaronchi/jrails

  - enable localization support in config/environment.rb, and change load_path
    to handle locale files recursively:

    config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')]
    config.i18n.default_locale = :en

== Installation

  - script/plugin install git://github.com/themactep/semantic-form-builder.git
 
  - rake semantic_form_builder:setup (if the installation script didn't move
    assets into corresponding directories)

  Be sure to include semantic_forms.css in your layout

== Usage

Continue using form_for and the tag helpers within it as you did before and it
should work fine. There has been a few additional tags added for convenience
sake. They are:

 - submit_or_cancel
 - radio_button_group
 - check_box_group

More documentation on their usage to come, in the interim check out or the
http://rubypond.com/articles/2008/07/16/sexy-forms-in-rails/ following
example:

<% form_for @document do |f|
  field_set_tag "Form Details" do %>
    <%= f.date_select :date, :required => true, :help => "date the something happened" %>
    <%= f.text_field :number, :required => true, :help => "the reference number for this thing" %>
    <%= f.select :external_id, [["Choose an option...",""]] + @externals.map {|c| [c.name, c.id]},
            :required => true, :label => "options", :help => "select something from the list" %>
    <%= f.check_box_tag_group "document[other_items][]",
            @others.map {|u| { :value => u.id, :label => u.description }},
            :label => "including these?",
            :help => "tick the whatever boxes are appropriate for this&nbsp;thing" %>
    <%= f.text_field :name, :help => "what was Willis talkin' about?" %>
    <%= f.check_box :list, :label => "mailing list", :help => "can we send you a bunch of spam?" %>
    <%= f.submit_or_cancel %>
<% end
end %>
Something went wrong with that request. Please try again.