wicked 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of wicked might be problematic. Click here for more details.

@@ -1,3 +1,9 @@
1
+ ## 0.1.4 (4/01/2012)
2
+
3
+ * expose `steps` and `wizard_steps` to view
4
+ * default index path of wizard controller to the first step
5
+ * paths to first and last steps `/wizard_first` & `/wizard_last`
6
+
1
7
  ## 0.1.3 (4/01/2012)
2
8
 
3
9
  * previous_wizard_path introduced
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
@@ -28,12 +28,14 @@ module Wicked::Controller::Concerns::Steps
28
28
  def steps
29
29
  self.class.steps
30
30
  end
31
+ alias :wizard_steps :steps
32
+ alias :steps_list :steps
31
33
 
32
34
  def previous_step(current_step = nil)
33
35
  return @previous_step if current_step == nil
34
- index = steps.index(current_step)
35
- step = steps.at(index - 1) if index.present? && index != 0
36
- step ||= nil
36
+ index = steps.index(current_step)
37
+ step = steps.at(index - 1) if index.present? && index != 0
38
+ step ||= steps.first
37
39
  step
38
40
  end
39
41
 
@@ -9,13 +9,20 @@ module Wicked
9
9
 
10
10
  included do
11
11
  # Give our Views helper methods!
12
- helper_method :wizard_path, :next_wizard_path, :previous_wizard_path
12
+ helper_method :wizard_path, :next_wizard_path, :previous_wizard_path, :step, :wizard_steps
13
13
  # Set @step and @next_step variables
14
14
  before_filter :setup_wizard
15
15
  end
16
16
 
17
+ def index
18
+ redirect_to wizard_path(steps.first)
19
+ end
20
+
17
21
  private
18
22
  def setup_wizard
23
+ redirect_to wizard_path(steps.first) if params[:id].try(:to_sym) == :wizard_first
24
+ redirect_to wizard_path(steps.last) if params[:id].try(:to_sym) == :wizard_last
25
+
19
26
  @step = params[:id].try(:to_sym) || steps.first
20
27
  @previous_step = previous_step(@step)
21
28
  @next_step = next_step(@step)
@@ -1 +1,3 @@
1
- last_step
1
+ last_step
2
+
3
+ <%= "step #{wizard_steps.index(step) + 1 } of #{wizard_steps.count}" %>
@@ -30,4 +30,10 @@ class HelpersTest < ActiveSupport::IntegrationCase
30
30
  assert has_content?("first")
31
31
  end
32
32
 
33
+ test 'wizard_steps' do
34
+ step = :last_step
35
+ visit(bar_path(step))
36
+ assert has_content?("step 3 of 3")
37
+ end
38
+
33
39
  end
@@ -2,6 +2,11 @@ require 'test_helper'
2
2
 
3
3
  class InheritNavigationTest < ActiveSupport::IntegrationCase
4
4
 
5
+ test 'default index' do
6
+ visit(foo_index_path)
7
+ assert has_content?('first')
8
+ end
9
+
5
10
  test 'show first' do
6
11
  step = :first
7
12
  visit(foo_path(step))
@@ -56,6 +61,16 @@ class IncludeNavigationTest < ActiveSupport::IntegrationCase
56
61
  assert has_content?(:second.to_s)
57
62
  end
58
63
 
64
+ test 'pointer to first' do
65
+ visit(bar_path(:wizard_first))
66
+ assert has_content?('first')
67
+ end
68
+
69
+ test 'pointer to last' do
70
+ visit(bar_path(:wizard_last))
71
+ assert has_content?('last_step')
72
+ end
73
+
59
74
  test 'invalid step' do
60
75
  step = :notastep
61
76
  assert_raise(ActionView::MissingTemplate) do
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "wicked"
8
- s.version = "0.1.3"
8
+ s.version = "0.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["schneems"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wicked
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-01 00:00:00.000000000 Z
12
+ date: 2012-04-01 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &70359853035280 !ruby/object:Gem::Requirement
16
+ requirement: &70096851450500 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.0.7
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70359853035280
24
+ version_requirements: *70096851450500
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rails
27
- requirement: &70359853033100 !ruby/object:Gem::Requirement
27
+ requirement: &70096851449960 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 3.0.7
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70359853033100
35
+ version_requirements: *70096851449960
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: jeweler
38
- requirement: &70359853030180 !ruby/object:Gem::Requirement
38
+ requirement: &70096851449340 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.6.4
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70359853030180
46
+ version_requirements: *70096851449340
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
- requirement: &70359853028820 !ruby/object:Gem::Requirement
49
+ requirement: &70096851448840 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.0.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70359853028820
57
+ version_requirements: *70096851448840
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rcov
60
- requirement: &70359853060960 !ruby/object:Gem::Requirement
60
+ requirement: &70096851448300 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70359853060960
68
+ version_requirements: *70096851448300
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: capybara
71
- requirement: &70359853059300 !ruby/object:Gem::Requirement
71
+ requirement: &70096851447660 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 0.4.0
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70359853059300
79
+ version_requirements: *70096851447660
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: sqlite3
82
- requirement: &70359853058200 !ruby/object:Gem::Requirement
82
+ requirement: &70096851447120 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70359853058200
90
+ version_requirements: *70096851447120
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: launchy
93
- requirement: &70359853056860 !ruby/object:Gem::Requirement
93
+ requirement: &70096851446500 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70359853056860
101
+ version_requirements: *70096851446500
102
102
  description: Wicked is a Rails engine for producing easy wizard controllers
103
103
  email: richard.schneeman@gmail.com
104
104
  executables: []
@@ -182,7 +182,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
182
182
  version: '0'
183
183
  segments:
184
184
  - 0
185
- hash: 192248127634563940
185
+ hash: 4278521625544091201
186
186
  required_rubygems_version: !ruby/object:Gem::Requirement
187
187
  none: false
188
188
  requirements: