gendalf 0.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -0
- data/Manifest +2 -0
- data/README.markdown +74 -0
- data/gendalf.gemspec +5 -6
- data/lib/controllers/wizard_controller.rb +3 -1
- metadata +9 -7
data/CHANGELOG
CHANGED
data/Manifest
CHANGED
data/README.markdown
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
Gendalf wizard helper gem
|
2
|
+
=========================
|
3
|
+
|
4
|
+
Makes it easier to add wizard-like behaviour to your application.
|
5
|
+
|
6
|
+
[Make yourself] an example
|
7
|
+
==========================
|
8
|
+
|
9
|
+
1. Connect Gendalf wizardry gem to your application:
|
10
|
+
|
11
|
+
gem 'gendalf'
|
12
|
+
|
13
|
+
2. Create the source files in your project:
|
14
|
+
|
15
|
+
custom_wizard_controller.rb
|
16
|
+
---------------------------
|
17
|
+
|
18
|
+
class CustomWizardController < Gendalf::WizardController
|
19
|
+
layout "application"
|
20
|
+
set_model_name :user_info
|
21
|
+
|
22
|
+
def step0
|
23
|
+
end
|
24
|
+
|
25
|
+
def step1
|
26
|
+
end
|
27
|
+
|
28
|
+
def step2
|
29
|
+
@user_info = session[:user_info]
|
30
|
+
end
|
31
|
+
|
32
|
+
protected
|
33
|
+
def wizard_model
|
34
|
+
session[:user_info] ||= UserInfo.new
|
35
|
+
end
|
36
|
+
|
37
|
+
def current_step
|
38
|
+
session[:current_step] ||= 0
|
39
|
+
end
|
40
|
+
|
41
|
+
def current_step=(step)
|
42
|
+
session[:current_step] = step
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
user_info.rb
|
47
|
+
------------
|
48
|
+
|
49
|
+
class UserInfo < Gendalf::WizardModel
|
50
|
+
define_step 0, :name do
|
51
|
+
validates_presence_of :name
|
52
|
+
end
|
53
|
+
|
54
|
+
define_step 1, :surname do
|
55
|
+
validates_presence_of :surname
|
56
|
+
end
|
57
|
+
|
58
|
+
define_final_step 2
|
59
|
+
end
|
60
|
+
|
61
|
+
3. Add the route:
|
62
|
+
|
63
|
+
wizard 'wizard', :custom_wizard, 3
|
64
|
+
|
65
|
+
4. Launch the application and navigate to http://localhost:3000/wizard/ .
|
66
|
+
|
67
|
+
Get a working example
|
68
|
+
==========================
|
69
|
+
|
70
|
+
1. Clone the [repository](http://github.com/SkyWriter/Gendalf-Demo): git://github.com/SkyWriter/Gendalf-Demo.git .
|
71
|
+
|
72
|
+
2. Run bundler.
|
73
|
+
|
74
|
+
3. Launch the application and navigate to http://localhost:3000/wizard/ .
|
data/gendalf.gemspec
CHANGED
@@ -2,24 +2,23 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{gendalf}
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.4"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Ivan Kasatenko"]
|
9
|
-
s.date = %q{2011-02-
|
9
|
+
s.date = %q{2011-02-25}
|
10
10
|
s.description = %q{Trivial gem to support wizard application style creation.}
|
11
11
|
s.email = %q{sky.31338@gmail.com}
|
12
|
-
s.extra_rdoc_files = ["CHANGELOG", "lib/controllers/wizard_controller.rb", "lib/extensions/routes.rb", "lib/gendalf.rb", "lib/models/wizard_model.rb"]
|
13
|
-
s.files = ["CHANGELOG", "Manifest", "Rakefile", "lib/controllers/wizard_controller.rb", "lib/extensions/routes.rb", "lib/gendalf.rb", "lib/models/wizard_model.rb"
|
12
|
+
s.extra_rdoc_files = ["CHANGELOG", "README.markdown", "lib/controllers/wizard_controller.rb", "lib/extensions/routes.rb", "lib/gendalf.rb", "lib/models/wizard_model.rb"]
|
13
|
+
s.files = ["CHANGELOG", "Manifest", "README.markdown", "Rakefile", "gendalf.gemspec", "lib/controllers/wizard_controller.rb", "lib/extensions/routes.rb", "lib/gendalf.rb", "lib/models/wizard_model.rb"]
|
14
14
|
s.homepage = %q{http://github.com/skywriter/gendalf}
|
15
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Gendalf", "--main", "README.markdown"]
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
s.rubyforge_project = %q{gendalf}
|
18
|
-
s.rubygems_version = %q{1.
|
18
|
+
s.rubygems_version = %q{1.5.2}
|
19
19
|
s.summary = %q{Trivial gem to support wizard application style creation.}
|
20
20
|
|
21
21
|
if s.respond_to? :specification_version then
|
22
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
23
22
|
s.specification_version = 3
|
24
23
|
|
25
24
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
@@ -61,7 +61,9 @@ module Gendalf
|
|
61
61
|
private
|
62
62
|
|
63
63
|
def redirect_to_current_step
|
64
|
-
|
64
|
+
if /step\d+(|_submit)/.match(params[:action]) && step_no != current_step
|
65
|
+
redirect_to wizard_path(current_step)
|
66
|
+
end
|
65
67
|
end
|
66
68
|
|
67
69
|
def param_name
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gendalf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 3
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: "0.
|
8
|
+
- 4
|
9
|
+
version: "0.4"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Ivan Kasatenko
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-02-
|
17
|
+
date: 2011-02-25 00:00:00 +03:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -67,6 +67,7 @@ extensions: []
|
|
67
67
|
|
68
68
|
extra_rdoc_files:
|
69
69
|
- CHANGELOG
|
70
|
+
- README.markdown
|
70
71
|
- lib/controllers/wizard_controller.rb
|
71
72
|
- lib/extensions/routes.rb
|
72
73
|
- lib/gendalf.rb
|
@@ -74,12 +75,13 @@ extra_rdoc_files:
|
|
74
75
|
files:
|
75
76
|
- CHANGELOG
|
76
77
|
- Manifest
|
78
|
+
- README.markdown
|
77
79
|
- Rakefile
|
80
|
+
- gendalf.gemspec
|
78
81
|
- lib/controllers/wizard_controller.rb
|
79
82
|
- lib/extensions/routes.rb
|
80
83
|
- lib/gendalf.rb
|
81
84
|
- lib/models/wizard_model.rb
|
82
|
-
- gendalf.gemspec
|
83
85
|
has_rdoc: true
|
84
86
|
homepage: http://github.com/skywriter/gendalf
|
85
87
|
licenses: []
|
@@ -116,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
118
|
requirements: []
|
117
119
|
|
118
120
|
rubyforge_project: gendalf
|
119
|
-
rubygems_version: 1.
|
121
|
+
rubygems_version: 1.5.2
|
120
122
|
signing_key:
|
121
123
|
specification_version: 3
|
122
124
|
summary: Trivial gem to support wizard application style creation.
|