Permalink
Browse files

burned the 'extending Formtastic' from README... will write a simpler…

… and more up-to-date version in the wiki soon
  • Loading branch information...
1 parent 9af5cc8 commit fcf66e4362a4bd51238854ac266daef176b6fda9 @justinfrench committed Feb 28, 2009
Showing with 1 addition and 41 deletions.
  1. +1 −41 README.textile
View
@@ -241,7 +241,7 @@ I'm only testing Formtastic with the latest Rails 2.2.x stable release, and it s
h2. What about Stylesheets?
-A proof-of-concept (very much a work-in-progress) stylesheet is provided which you can include in your layout. Customisation is best achieved by overriding these styles in an additional stylesheet so that the formtastic styles can be updated without clobbering your changes.
+A proof-of-concept (very much a work-in-progress) stylesheet is provided which you can include in your layout. Customization is best achieved by overriding these styles in an additional stylesheet so that the Formtastic styles can be updated without clobbering your changes.
1. Use the generator to copy the formtastic.css and formtastic_changes.css into your public directory
@@ -257,46 +257,6 @@ A proof-of-concept (very much a work-in-progress) stylesheet is provided which y
</pre>
-h2. Extending Formtastic
-
-Adding functionality to Formtastic can be done by subclassing SemanticFormBuilder with your own changes, then telling Formtastic to use yours instead.
-
-To create a new form method that displayed a star rating define the new builder by subclassing SemanticFormBuilder:
-
-<pre>
- # lib/rating_semantic_form_builder.rb
- class RatingBuilder < Formtastic::SemanticFormBuilder
- # new method to be added allowing full control over the label and value
- def rating(stars, options = {})
- options[:label] ||= 'rating'
- content = input_label(options[:label], options)
- content += @template.content_tag(:span, '*' * stars.to_i, :id => "#{@object_name}_#{options[:label]}")
- @template.content_tag(:li, content)
- end
- end
-</pre>
-
-Set Formtastic's builder to your newly defined RatingBuilder
-<pre>
- # RAILS_ROOT/config/initializers/override_formtastic_builder.rb
- require 'rating_semantic_form_builder.rb'
-
- # set the formtastic builder to a customized version of the formtastic builder
- Formtastic::SemanticFormHelper.builder = RatingBuilder
-</pre>
-
-Use @semantic_form_for@ just like you would with Formtastic.
-<pre>
- <% semantic_form_for Project.new do |form| %>
- <% form.input_field_set :name => "ratings" do %>
- <%= form.rating 5 %>
- <%= form.rating 11, :label => 'awesomeness (out of 10)' %>
- <% end %>
- <%= form.buttons %>
- <% end %>
-</pre>
-
-
h2. Many thanks to Formtastic's contributors
* "Justin French":http://justinfrench.com

0 comments on commit fcf66e4

Please sign in to comment.