README.md in formal-0.0.1 vs README.md in formal-0.0.2

- old
+ new

@@ -1,8 +1,9 @@ # Formal -TODO: Write a gem description +Formal is simply a form builder that provides the markup we typically use +around form fields on Hashrocket projects. ## Installation Add this line to your application's Gemfile: @@ -16,25 +17,65 @@ $ gem install formal ## Usage - Specify the builder option in your form_for parameters +```ruby += form_for post, builder: Formal::Builder do |f| ``` - = form_for post, builder: Formal::Builder do |f| + + +```f.label``` gets wrapped in a ```<dt>``` or a ```<dt class="error">```(wherethere is an error) + + +The following get wrapped in a ```<dd>``` or a ```<dd class="error">```: + +```ruby +f.text_field +f.password_field +f.text_area +f.select +f.email_field +f.search_field ``` -This will wrap a ```<dt>``` around labels and a ```<dd>``` around the following helpers: +__Example:__ -- label_tag -- text_field -- password_field -- text_area -- select -- email_field -- search_field +```ruby +f.text_field :body +``` + +returns + +```HTML +<dd> + <input type="text" id="post_body" name="post[body]" /> +</dd> +``` + +Also provided is a helper for a label with a checkbox __inside__ it (which is +also wrapped in a ```<dt>```). Use: + +```ruby +f.checkbox_with_label :published +``` + +which returns: + +```html +<dt> + <label for="post_published"> + <input name="post[published]" type="hidden" value="0" /> + <input id="post_published" name="post[published]" type="checkbox" value="1" /> + published + </label> +</dt> +``` + + + ## Contributing 1. Fork it