effective_resources 1.8.27 → 1.8.31
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/app/controllers/concerns/effective/wizard_controller/actions.rb +5 -2
- data/app/controllers/concerns/effective/wizard_controller/save.rb +9 -1
- data/app/helpers/effective_resources_helper.rb +2 -0
- data/app/models/concerns/acts_as_wizard.rb +2 -0
- data/app/models/concerns/has_many_rich_texts.rb +2 -2
- data/lib/effective_resources/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2cac8ab4956bad6e580c5edfe77d2040d13430b327acff13874f0d447e2cb154
|
4
|
+
data.tar.gz: 9d2aeb097b2a71715aec44af86b49628549c0083ecd757f742047ae17842207b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c04ecb8170f56016f354a93dd1be925ac08cef0f9dc77b93027457fa30b3382907943083877f47daa6dc000e700be9594a69e52a69fe63a0846a1d988413876c
|
7
|
+
data.tar.gz: 73e362b25cc6acbc6c9abf0c8e8c87ad1a9b19d4a2d4c4e5f0a21cdc9f4071e8084ec15685fcb29a8d96bd1d9241c36f4d2569c79244247c3df8cd77eca2c333
|
data/README.md
CHANGED
@@ -352,6 +352,8 @@ Here's `views/things/start.html.haml`:
|
|
352
352
|
|
353
353
|
You can also call `render_wizard_sidebar(resource)` without the block syntax.
|
354
354
|
|
355
|
+
If you add `f.hidden_field(:skip_to_step, value: 'stepc')` you can control the next step.
|
356
|
+
|
355
357
|
## Testing
|
356
358
|
|
357
359
|
Run tests by:
|
@@ -5,10 +5,13 @@ module Effective
|
|
5
5
|
def new
|
6
6
|
Rails.logger.info 'Processed by Effective::WizardController#new'
|
7
7
|
|
8
|
-
self.resource ||= resource_scope.new
|
8
|
+
self.resource ||= (find_wizard_resource || resource_scope.new)
|
9
9
|
EffectiveResources.authorize!(self, :new, resource)
|
10
10
|
|
11
|
-
redirect_to resource_wizard_path(
|
11
|
+
redirect_to resource_wizard_path(
|
12
|
+
(resource.to_param || :new),
|
13
|
+
(resource.first_uncompleted_step || resource_wizard_steps.first)
|
14
|
+
)
|
12
15
|
end
|
13
16
|
|
14
17
|
def show
|
@@ -9,7 +9,7 @@ module Effective
|
|
9
9
|
if save_resource(resource, action)
|
10
10
|
flash[:success] ||= options.delete(:success) || resource_flash(:success, resource, action)
|
11
11
|
|
12
|
-
@skip_to ||= resource
|
12
|
+
@skip_to ||= skip_to_step(resource)
|
13
13
|
@redirect_to ||= resource_wizard_path(resource, @skip_to) if was_new_record
|
14
14
|
|
15
15
|
redirect_to(@redirect_to || wizard_path(@skip_to))
|
@@ -19,6 +19,14 @@ module Effective
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
private
|
23
|
+
|
24
|
+
def skip_to_step(resource)
|
25
|
+
resource.skip_to_step ||
|
26
|
+
resource.required_steps.find { |s| s == next_step } ||
|
27
|
+
resource.first_uncompleted_step
|
28
|
+
end
|
29
|
+
|
22
30
|
end
|
23
31
|
end
|
24
32
|
end
|
@@ -59,6 +59,8 @@ module EffectiveResourcesHelper
|
|
59
59
|
# locals: {} render locals
|
60
60
|
# you can also pass all action names and true/false such as edit: true, show: false
|
61
61
|
def render_resource_actions(resource, atts = {}, &block)
|
62
|
+
return ''.html_safe if resource.blank?
|
63
|
+
|
62
64
|
unless resource.kind_of?(ActiveRecord::Base) || resource.kind_of?(Class) || resource.kind_of?(Array) || resource.class.ancestors.include?(ActiveModel::Model)
|
63
65
|
raise 'expected first argument to be an ActiveRecord::Base object or Array of objects'
|
64
66
|
end
|
@@ -39,9 +39,9 @@ module HasManyRichTexts
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def method_missing(method, *args, &block)
|
42
|
-
|
43
|
-
super unless method.start_with?('rich_text_')
|
42
|
+
return super unless method.to_s.start_with?('rich_text_')
|
44
43
|
|
44
|
+
method = method.to_s
|
45
45
|
name = method.chomp('=').sub('rich_text_', '')
|
46
46
|
|
47
47
|
if method.end_with?('=')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_resources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.31
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|