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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b63f9f8d7d8f8c637a0aadb1efee7dbc2342375e
4
- data.tar.gz: 3c318690cd2f9f2f0a5b24fae6ad990351398b60
2
+ SHA256:
3
+ metadata.gz: e96378355b47c275b83c88d56fe9e1990b4f11f0c63eaa5f9a35a7e96d16fd22
4
+ data.tar.gz: 74d23604baf926973c6ffc93d968f28ff185112266e22f9c2c56911e6217b133
5
5
  SHA512:
6
- metadata.gz: ec7cdb890f429b88a73cf90c057ecbdfd89118a0287f02da5d3c293f3f807e1c9ac364945422a6c4ea9737cdbd77ccc4984a58c3b866251775a380770cd56045
7
- data.tar.gz: b7d891997073d41429a7aa45cd6c7ee8b9d76782ddab6915ef1664df2939f5a854e8f094367cc13ff6e3accdb703514fa269753b64eba28f2a11aa54919da882
6
+ metadata.gz: 612558d4b0072ff42dd1c336bdc20d91827d1fd57b71cd8ef20b318ae240c490c39fd0065e2dd48b73179c6f6a549ed2b3fe4476f0fa9df16be6a60bfa0c27c3
7
+ data.tar.gz: fc0ec0f5146b016608ef7bcca9d5d364b257bb5a52488a7e1afc06a97deeda9991b3b2c7e74a73c5232288a63549e72dc8135b54b41a58bf0f9f1fe4f509a6b0
@@ -1,5 +1,9 @@
1
1
  ## Master
2
2
 
3
+ ## 1.3.3
4
+
5
+ * Support being able to set a context in validation (https://github.com/schneems/wicked/pull/236)
6
+
3
7
  ## 1.3.2
4
8
 
5
9
  * Support for params (#222)
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 # Sets the order of steps
187
- step # Gets current step
188
- next_step # Gets next step
189
- previous_step # Gets previous step
190
- skip_step # Tells render_wizard to skip to the next logical step
191
- jump_to(:specific_step) # Jump to :specific_step
192
- render_wizard # Renders the current step
193
- render_wizard(@user) # Shows next_step if @user.save, otherwise renders
194
- wizard_steps # Gets ordered list of steps
195
- past_step?(step) # does step come before the current request's step in wizard_steps
196
- future_step?(step) # does step come after the current request's step in wizard_steps
197
- previous_step?(step) # is step immediately before the current request's step
198
- next_step?(step) # is step immediately after the current request's step
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
- if resource
18
- if resource.save
19
- @skip_to ||= @next_step
20
- else
21
- @skip_to = nil
22
- end
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
-
@@ -1,3 +1,3 @@
1
1
  module Wicked
2
- VERSION = "1.3.2"
2
+ VERSION = "1.3.3"
3
3
  end
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.2
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: 2017-06-23 00:00:00.000000000 Z
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.11
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