Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A Rails form generator that creates simple markup
Ruby Other

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
.travis.yml
Appraisals
Gemfile
Gemfile.lock
LICENSE
README.rdoc
Rakefile
formula.gemspec

README.rdoc

Formula

Formula is a Rails form helper that generates awesome markup. The project lets users create semantically beautiful forms without introducing too much syntax.

Requirements

The gem is tested with:

  • Ruby on Rails 3.1.1

  • Ruby (MRI) 1.9.3 (p0)

  • Ruby (MRI) 1.9.2 (p290)

  • Ruby (MRI) 1.8.7 (p352)

  • Ruby (REE) 1.8.7 (2011.03)

  • JRuby 1.6.5

  • Rubinius 1.2.4

Installation

gem install formula

Examples

<% formula_form_for @user do |f| %>
  <%= f.input :email %>
  <%= f.input :password %>
  <%= f.button 'Save' } %>
<% end %>

<% formula_form_for @user do |f| %>
  <%= f.input :email, label: "Email:", hint: "We promise never to bother you." %>
  <%= f.input :password, label: "Password:", hint: "Must be at least six characters." %>
  <%= f.button 'Save' %>
<% end %>

<% formula_form_for @company do |f|
  <%= f.input :url,   container: { class: 'grid-04' }, input: { class: 'fill' } %>
  <%= f.input :phone, container: { class: 'grid-04' }, input: { class: 'fill' } %>
  <%= f.input :email, container: { class: 'grid-04' }, input: { class: 'fill' } %>
  <%= f.button 'Save', button: { class: 'fancy' } %>
<% end %>

<% formula_form_for @user do |f| %>
  <%= f.input :email, label: "Email:" %>
  <%= f.input :password, label: "Password:" %>
  <%= f.input :gender, label: 'Gender:', as: :select, choices: User::GENDERS %>
  <% formula_fields_for @user.payment do |payment_f| %>
    <%= payment_f.input :credit_card_number, label: 'Number:' %>
    <%= payment_f.input :credit_card_expiration, label: 'Expiration:' %>
  <% end %>
  <%= f.button 'Save', button: { class: 'fancy' } %>
<% end %>

<% formula_form_for @user do |f| %>
  <%= f.block :favourite %>
    <% @favourites.each do |favourite| %>
      ...
    <% end %>
  <% end %>
  <%= f.button 'Save', button: { class: 'fancy' } %>
<% end %>

Contributors

  • Iliya Grushevskiy

Status

Copyright

Copyright © 2010 - 2012 Kevin Sylvestre. See LICENSE for details.

Something went wrong with that request. Please try again.