wizard_controller 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/README.rdoc +6 -0
  2. data/lib/wizard_controller.rb +86 -1
  3. metadata +1 -1
data/README.rdoc CHANGED
@@ -11,6 +11,12 @@ VERY IMPORTANT!!! DONT OVERRIDE INDEX!
11
11
  Doing so will break all functionality. WizardController works by defining an
12
12
  "index" method that does all the work. To start a wizard, go to the "index" method.
13
13
 
14
+ === Setup and Configuration
15
+
16
+ Add the gem configuration to your config/environment.rb
17
+
18
+ config.gem "wizard_controller"
19
+
14
20
  === Example Controller
15
21
 
16
22
  class ExampleController < Codeprimate::Wizard::Base
@@ -1,6 +1,87 @@
1
1
  module Codeprimate
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
 
4
+ # = Wizard Controller
5
+ #
6
+ # Wizard controller provides a base class (Inheriting from ActionController::Base)
7
+ # that provides a DSL for quickly making Wizards.
8
+ #
9
+ # In order for this to work, you need to have this standard route present:
10
+ #
11
+ # map.connect ':controller/:action/:id'
12
+ #
13
+ # VERY IMPORTANT!!! DONT OVERRIDE INDEX!
14
+ # Doing so will break all functionality. WizardController works by defining an
15
+ # "index" method that does all the work. To start a wizard, go to the "index" method.
16
+ #
17
+ # === Setup and Configuration
18
+ #
19
+ # Add the gem configuration to your config/environment.rb
20
+ #
21
+ # config.gem "wizard_controller"
22
+ #
23
+ # === Example Controller
24
+ #
25
+ # class ExampleController < Codeprimate::Wizard::Base
26
+ # # Define the method names of the wixard steps
27
+ # define_steps :page_one, :page_two, :page_three
28
+ #
29
+ # # Specify where the Wizard should redirect upon completion.
30
+ # set_finish_path "http://www.example.com/go_here_when_done.html"
31
+ #
32
+ #
33
+ # # Ensure "index" is not defined!
34
+ # # def index
35
+ # # end
36
+ #
37
+ # def start
38
+ # # Create a "safe" index method for this controller, and handle it appropriately
39
+ # end
40
+ #
41
+ # def foobar
42
+ # # You can define whatever actions you want. WizardController doesnt get in the way.
43
+ # end
44
+ #
45
+ # def page_one
46
+ # # This is a regular action method. Create indiviual views for action methods.
47
+ # end
48
+ #
49
+ # def process_page_one
50
+ # # Place logic to handle any output from page one here.
51
+ # # No view will be shown for this
52
+ # #
53
+ # # Return true if your logic wants you to go to the next step
54
+ # # Return false if you want to return to the page_one view
55
+ # return true
56
+ # end
57
+ #
58
+ # def page_two
59
+ # # Let's say this action/view is merely informative.
60
+ # # We will not supply a process method, and the user will always be able
61
+ # # to go to the next step
62
+ # end
63
+ #
64
+ # def page_three
65
+ # # Just another step method here
66
+ # end
67
+ #
68
+ # def process_page_three
69
+ # # Since this is the last step, if this process method returns true
70
+ # # the user will be redirected to the URL specified in the
71
+ # # "set_finish_path" declaration at the beginning of the Controller definition
72
+ # end
73
+ # end
74
+ #
75
+ # === View Helper Methods
76
+ #
77
+ # * <tt>step_number()</tt>: Current step index.
78
+ # * <tt>total_steps()</tt>: Total Number of steps in the wizard.
79
+ # * <tt>step_completed()</tt>: Returns boolean, whether the step has been completed.
80
+ # * <tt>wizard_path()</tt>: Wizard index path. <b>THIS SHOULD BE THE ACTION PATH OF ALL FORMS/VIEWS WITH A "process" action.</b>
81
+ # * <tt>next_step_path()</tt>: URL to the next step.
82
+ # * <tt>previous_step_path()</tt>: URL to the previous step.
83
+ # * <tt>reset_wizard_path()</tt>: URL to reset the Wizard.
84
+ # * <tt>abort_wizard_path()</tt>: URL to abort the Wizard.
4
85
  module Wizard
5
86
 
6
87
  class Base < ApplicationController
@@ -28,11 +109,15 @@ module Codeprimate
28
109
  end
29
110
 
30
111
  # Set the URL that a user is redirected to after aborting the Wizard.
112
+ #
113
+ # Should be a string
31
114
  def set_abort_path(p)
32
115
  self.abort_path = p
33
116
  end
34
117
 
35
118
  # Set the flash message a user sees when a process_action method returns false
119
+ #
120
+ # Should be a string
36
121
  def set_default_error(e)
37
122
  self.wizard_default_error = e
38
123
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wizard_controller
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Morgan