README.rdoc in stepper-0.0.1 vs README.rdoc in stepper-0.0.3
- old
+ new
@@ -1,11 +1,11 @@
= Stepper
-Stepper is multistep form (wizard) solution for Rails 3.
+Stepper is multistep form (wizard) solution for Rails 3.1.
Stepper allows you to split up your large form into series of pages that users can navigate through to complete the form and save it state.
== Installation
-You can use it with Rails 3:
+You can use it with Rails 3.1:
gem install stepper
== Getting Started
=== Configuring model
Create migration for model:
@@ -13,20 +13,25 @@
add_column :companies, :current_step, :string
add_index :companies, :current_step
Setup names of steps that you want to have:
- has_steps :steps => %w{name city kind}
+ class Company < ActiveRecord::Base
+ has_steps :steps => %w{ description kind address }
+ end
-Setup validation for each step if necessary, method should have name like <tt>validation_#{step_name}</tt>:
+Setup validation for each step if necessary, method should have name like <tt>validate_#{step_name}</tt>:
- def validate_name
+ def validate_description
self.validates_presence_of :name
+ self.validates_presence_of :desc
end
- def validate_city
+ def validate_address
self.validates_presence_of :city
+ self.validates_presence_of :country
+ self.validates_presence_of :address
end
def validate_kind
self.validates_presence_of :kind
end
@@ -54,19 +59,41 @@
+name_step.html.erb+
<%= f.label :name %>
<%= f.text_field :name %>
+ <%= f.label :desc %>
+ <%= f.text_field :desc %>
+city_step.html.erb+
<%= f.label :city %>
<%= f.text_field :city %>
+ <%= f.label :country %>
+ <%= f.text_field :country %>
+ <%= f.label :city %>
+ <%= f.text_field :city %>
+kind_step.html.erb+
<%= f.label :kind %>
<%= f.text_field :kind %>
+
++stepper+ helper creates buttons "Next", "Previous", "Save" and "Finish" as well. You can change button names just add to your locales:
+
+ en:
+ stepper:
+ next_step: 'Next step'
+ previous_step: 'Previous step'
+ save: 'Finish later'
+ finish: 'Finish'
+
++next_step+ button validates, saves current step and renders next step of form;
++previous_step+ saves current step and renders previous step of form;
++save+ save current step and redirects to index page;
++finish+ is showed only for last step instead of +next_step+ button and it validates, saves last step and redirects to show.
+
+If you want to have other partial for buttons than add partial to: +app/views/stepper/_fields.html.erb+
== Contributing to stepper
* 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