Sha256: 12a7714e0ebf7cbe6bfd6167f7578adfb389309337bfcdde6a8fd5bc22900bfa

Contents?: true

Size: 1.89 KB

Versions: 2

Compression:

Stored size: 1.89 KB

Contents

= Formize

Simple form DSL with dynamic interactions for Rails.

== Installation

Add it to your Gemfile:
  gem "formize"

It's not necessary, but I recommend to use HAML with it for cleaner views:
  gem "haml"

== Usage

In controller:

  class OrdersController < ApplicationController
    # Generates default helpers method and a controller method :formize
    # for a model Order.
    formize

    # Personnalized example
    formize do
      field :number
      field :created_on
      field :client
      field_set :addresses, :depend_on=>:client do
        field :default_contact, :choices=>:contacts, :source=>:client
        field :delivery_contact, :choices=>:contacts, :source=>:client
        field :invoice_contact, :choices=>:contacts, :source=>:client
      end
      field_set :track do
        field :responsible
        field :department
      end
    end

    # Moreover, with a specified model
    formize(:lines, :model=>:order_lines)

  end

In views:

  # app/views/orders/_form.html.haml
  =formize_form

or:

  # app/views/orders/_form.html.haml
  =form_tag do
    =formize_fields

or:

  # app/views/orders/_form.html.haml
  =formize_form :lines


== Contributing to Formize
 
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
* Fork the project
* Start a feature/bugfix branch
* Commit and push until you are happy with your contribution
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

== Copyright

Copyright (c) 2011 Brice Texier. See LICENSE.txt for
further details.

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
formize-0.0.3 README.rdoc
formize-0.0.2 README.rdoc