Browse files

Added documentation for the form generator in README, and showing som…

…e instructions on plugin and gem installation. Closes #118.
  • Loading branch information...
grimen authored and justinfrench committed Nov 19, 2009
1 parent afe0bd0 commit fef3288bb14d6c8ac7155f50f4e9a46f5c80d68e
Showing with 38 additions and 3 deletions.
  1. +32 −1 README.textile
  2. +4 −1 Rakefile
  3. +2 −1 install.rb
@@ -416,6 +416,38 @@ h2. Configuration
Run @./script/generate formtastic@ to copy a commented out config file into @config/initializers/formtastic.rb@. You can "view the configuration file on GitHub":
+h2. Form Generator
+There's a Formtastic form code generator to make your transition to Formtastic easier. All you have to do is to *specify an existing model name*, and optionally specify view template framework (ERB/HAML), and you are good to go. *Note:* This won't overwrite any of you stuff. This is how you use it:
+*Alt. 1: Generate in terminal:*
+$ ./script/generate form Post
+# ---------------------------------------------------------
+# ---------------------------------------------------------
+<% form.inputs do %>
+ <%= form.input :title, :label => 'Title' %>
+ <%= form.input :body, :label => 'Body' %>
+ <%= form.input :published, :label => 'Published' %>
+<% end %>
+# ---------------------------------------------------------
+ Copied to clipboard - just paste it!
+*Alt. 2: Generate partial:*
+$ ./script/generate form Post --partial
+ exists app/views/posts
+ create app/views/posts/_form.html.erb
+To generate *HAML* markup, just add the @--haml@ as argument: @./script/generate form Post --haml@
h2. Custom Inputs
If you want to add your own input types to encapsulate your own logic or interface patterns, you can do so by subclassing SemanticFormBuilder and configuring Formtastic to use your custom builder class.
@@ -441,7 +473,6 @@ h2. Compatibility
I'm only testing Formtastic with the latest Rails 2.4.x stable release, and it should be fine under Rails 2.3.x as well (including nested forms). Patches are welcome to allow backwards compatibility, but I don't have the energy!
h2. Got TextMate?
Well...there's a TextMate-bundle in town, dedicated to make usage of Formtastic in the "TextMate": editor even more of a breeze:
@@ -22,11 +22,14 @@ begin
Thanks for installing Formtastic!
- ------------------------------------------------------------------------
+ ------------------------------------------------------------------------
You can now (optionally) run the generater to copy some stylesheets and
a config initializer into your application:
./script/generate formtastic
+ To generate some semantic form markup for your exisiting models, just run:
+ ./script/generate form MODEL_NAME
Find out more and get involved:
@@ -1 +1,2 @@
-puts "Run `./script/generate formtastic` if you want (copies optional config file and some stylesheets into your app)"
+puts "Run `./script/generate formtastic` if you want (copies optional config file and some stylesheets into your app)"
+puts "Run `./script/generate form MODEL_NAME` to generate some semantic form markup for any existing model(s) (optional)"

0 comments on commit fef3288

Please sign in to comment.