effective_resources 1.8.29 → 1.8.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/controllers/concerns/effective/wizard_controller.rb +14 -0
- data/app/helpers/effective_resources_wizard_helper.rb +4 -2
- data/app/models/concerns/acts_as_slugged.rb +1 -1
- data/app/models/concerns/acts_as_wizard.rb +2 -0
- 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: 60cb47028d5031c44e6a833fd1750d6e9435ace75de88ffec3756378079ba13c
|
4
|
+
data.tar.gz: 9ceb601f1fdf5ab0784abe83b6f7d8071f66e079d7c5a3c7352dee0dda9b1abb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fe4309ff79c01a66217aee696f3bfa45d11d429d7a3dad84977351be8e0f9efd1091b6bc8398fcc46d131cc69a57d2251a2b365ddbd7fd4f0a4576c51ba6a5f
|
7
|
+
data.tar.gz: a88750936ed0d46ee4a8faa8a591fbd04dd9eef2eeedaa7f36c01a80bbeaff72690eed324974cdbaf12ed68b2f156ea91058c5250d5b415e80040f4edf0d9060
|
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
|
@@ -62,5 +62,19 @@ module Effective
|
|
62
62
|
wizard_path(step, resource_name_id => param)
|
63
63
|
end
|
64
64
|
|
65
|
+
private
|
66
|
+
|
67
|
+
def current_step_before?(nav_step)
|
68
|
+
index = wizard_steps.index(nav_step) || raise("step #{nav_step} not found in wizard_steps")
|
69
|
+
current = wizard_steps.index(step) || raise("current step not found in wizard_steps")
|
70
|
+
current < index
|
71
|
+
end
|
72
|
+
|
73
|
+
def current_step_after?(nav_step)
|
74
|
+
index = wizard_steps.index(nav_step) || raise("step #{nav_step} not found in wizard_steps")
|
75
|
+
current = wizard_steps.index(step) || raise("current step not found in wizard_steps")
|
76
|
+
current > index
|
77
|
+
end
|
78
|
+
|
65
79
|
end
|
66
80
|
end
|
@@ -2,8 +2,10 @@
|
|
2
2
|
|
3
3
|
module EffectiveResourcesWizardHelper
|
4
4
|
|
5
|
-
def render_wizard_sidebar(resource, numbers: true, &block)
|
6
|
-
|
5
|
+
def render_wizard_sidebar(resource, numbers: true, horizontal: false, &block)
|
6
|
+
klasses = ['wizard-sidebar', 'list-group', ('list-group-horizontal' if horizontal)].compact.join(' ')
|
7
|
+
|
8
|
+
sidebar = content_tag(:div, class: klasses) do
|
7
9
|
resource.required_steps.map.with_index do |nav_step, index|
|
8
10
|
render_wizard_sidebar_item(resource, nav_step, (index + 1 if numbers))
|
9
11
|
end.join.html_safe
|
@@ -2,7 +2,7 @@
|
|
2
2
|
#
|
3
3
|
# This module automatically generates slugs based on the :to_s field using a before_validation filter
|
4
4
|
#
|
5
|
-
# Mark your model with '
|
5
|
+
# Mark your model with 'acts_as_slugged' make sure you have a string field :slug
|
6
6
|
|
7
7
|
module ActsAsSlugged
|
8
8
|
extend ActiveSupport::Concern
|
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.33
|
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-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|