wicked 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +4 -0
- data/README.md +15 -13
- data/lib/wicked/controller/concerns/render_redirect.rb +14 -9
- data/lib/wicked/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e96378355b47c275b83c88d56fe9e1990b4f11f0c63eaa5f9a35a7e96d16fd22
|
4
|
+
data.tar.gz: 74d23604baf926973c6ffc93d968f28ff185112266e22f9c2c56911e6217b133
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 612558d4b0072ff42dd1c336bdc20d91827d1fd57b71cd8ef20b318ae240c490c39fd0065e2dd48b73179c6f6a549ed2b3fe4476f0fa9df16be6a60bfa0c27c3
|
7
|
+
data.tar.gz: fc0ec0f5146b016608ef7bcca9d5d364b257bb5a52488a7e1afc06a97deeda9991b3b2c7e74a73c5232288a63549e72dc8135b54b41a58bf0f9f1fe4f509a6b0
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
|
5
5
|
[![Build Status](https://travis-ci.org/schneems/wicked.svg?branch=master)](https://travis-ci.org/schneems/wicked)
|
6
6
|
[![Code Climate](https://codeclimate.com/github/schneems/wicked/badges/gpa.svg)](https://codeclimate.com/github/schneems/wicked)
|
7
|
+
[![Help Contribute to Open Source](https://www.codetriage.com/schneems/wicked/badges/users.svg)](https://www.codetriage.com/schneems/wicked)
|
7
8
|
|
8
9
|
|
9
10
|
Use wicked to make your Rails controllers into step-by-step wizards. To see Wicked in action check out the example [Rails app](https://github.com/schneems/wicked_example) or [watch the screencast](http://schneems.com/post/18437886598/wizard-ify-your-rails-controllers-with-wicked).
|
@@ -183,19 +184,20 @@ previous_wizard_path # Url of the previous step
|
|
183
184
|
**Controller Tidbits:**
|
184
185
|
|
185
186
|
```ruby
|
186
|
-
steps :first, :second
|
187
|
-
step
|
188
|
-
next_step
|
189
|
-
previous_step
|
190
|
-
skip_step
|
191
|
-
jump_to(:specific_step)
|
192
|
-
render_wizard
|
193
|
-
render_wizard(@user)
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
187
|
+
steps :first, :second # Sets the order of steps
|
188
|
+
step # Gets current step
|
189
|
+
next_step # Gets next step
|
190
|
+
previous_step # Gets previous step
|
191
|
+
skip_step # Tells render_wizard to skip to the next logical step
|
192
|
+
jump_to(:specific_step) # Jump to :specific_step
|
193
|
+
render_wizard # Renders the current step
|
194
|
+
render_wizard(@user) # Shows next_step if @user.save, otherwise renders
|
195
|
+
render_wizard(@user, context: :account_setup) # Shows next_step if @user.save(context: :account_setup), otherwise renders
|
196
|
+
wizard_steps # Gets ordered list of steps
|
197
|
+
past_step?(step) # does step come before the current request's step in wizard_steps
|
198
|
+
future_step?(step) # does step come after the current request's step in wizard_steps
|
199
|
+
previous_step?(step) # is step immediately before the current request's step
|
200
|
+
next_step?(step) # is step immediately after the current request's step
|
199
201
|
```
|
200
202
|
|
201
203
|
**Redirect options**
|
@@ -3,7 +3,7 @@ module Wicked::Controller::Concerns::RenderRedirect
|
|
3
3
|
|
4
4
|
|
5
5
|
def render_wizard(resource = nil, options = {}, params = {})
|
6
|
-
process_resource!(resource)
|
6
|
+
process_resource!(resource, options)
|
7
7
|
|
8
8
|
if @skip_to
|
9
9
|
url_params = (@wicked_redirect_params || {}).merge(params)
|
@@ -13,13 +13,19 @@ module Wicked::Controller::Concerns::RenderRedirect
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
def process_resource!(resource)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
16
|
+
def process_resource!(resource, options = {})
|
17
|
+
return unless resource
|
18
|
+
|
19
|
+
if options[:context] && resource.method(:save).arity >= 1
|
20
|
+
did_save = resource.save(context: options[:context])
|
21
|
+
else
|
22
|
+
did_save = resource.save
|
23
|
+
end
|
24
|
+
|
25
|
+
if did_save
|
26
|
+
@skip_to ||= @next_step
|
27
|
+
else
|
28
|
+
@skip_to = nil
|
23
29
|
end
|
24
30
|
end
|
25
31
|
|
@@ -54,4 +60,3 @@ module Wicked::Controller::Concerns::RenderRedirect
|
|
54
60
|
redirect_to wicked_final_redirect_path, options
|
55
61
|
end
|
56
62
|
end
|
57
|
-
|
data/lib/wicked/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wicked
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Schneeman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -233,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
233
233
|
version: '0'
|
234
234
|
requirements: []
|
235
235
|
rubyforge_project:
|
236
|
-
rubygems_version: 2.6
|
236
|
+
rubygems_version: 2.7.6
|
237
237
|
signing_key:
|
238
238
|
specification_version: 4
|
239
239
|
summary: Use Wicked to turn your controller into a wizard
|