effective_resources 1.8.15 → 1.8.16
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/app/controllers/concerns/effective/wizard_controller.rb +2 -2
- data/app/controllers/concerns/effective/wizard_controller/actions.rb +1 -1
- data/app/controllers/concerns/effective/wizard_controller/before_actions.rb +2 -2
- data/app/helpers/effective_resources_wizard_helper.rb +1 -1
- data/app/models/concerns/acts_as_wizard.rb +5 -0
- data/lib/effective_resources/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a854fdf544ea77faf7d45b251f8161b54ef66685c71730d6b4bdef42298ac371
|
4
|
+
data.tar.gz: 22d0141d18a049ed853d2ba54197758e46817ffdf6704c1facee7850cad5bef6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa64174fb405b2499a303ed87d64b8e32aa4d7c48388875c811919526935679a4c98bfef973e0f41b2124257b5d9d46207e906f85776d5eb5c0bf487ee086179
|
7
|
+
data.tar.gz: e00c2e31e5430de0a3e19d2f0d607fa73426edbbe8f7d31c0936f60a418a4bf92206fef2d904d2ba78dab1bfffc132235056ad138ede924642cabdeffd8a6408
|
@@ -46,9 +46,9 @@ module Effective
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
def resource_wizard_step_title(step)
|
49
|
+
def resource_wizard_step_title(resource, step)
|
50
50
|
return if step == 'wicked_finish'
|
51
|
-
|
51
|
+
resource.wizard_step_title(step)
|
52
52
|
end
|
53
53
|
|
54
54
|
def resource_wizard_steps
|
@@ -8,7 +8,7 @@ module Effective
|
|
8
8
|
self.resource ||= resource_scope.new
|
9
9
|
EffectiveResources.authorize!(self, :new, resource)
|
10
10
|
|
11
|
-
redirect_to resource_wizard_path(:new, resource_wizard_steps.first)
|
11
|
+
redirect_to resource_wizard_path(:new, resource.first_uncompleted_step || resource_wizard_steps.first)
|
12
12
|
end
|
13
13
|
|
14
14
|
def show
|
@@ -49,7 +49,7 @@ module Effective
|
|
49
49
|
Rails.logger.info " Unable to visit step :#{step}. Last can_visit_step? is :#{next_step}. Change the acts_as_wizard model's can_visit_step?(step) function to change this."
|
50
50
|
end
|
51
51
|
|
52
|
-
flash[:success] = "You have been redirected to the #{resource_wizard_step_title(next_step)} step."
|
52
|
+
flash[:success] = "You have been redirected to the #{resource_wizard_step_title(resource, next_step)} step."
|
53
53
|
redirect_to wizard_path(next_step)
|
54
54
|
end
|
55
55
|
|
@@ -66,7 +66,7 @@ module Effective
|
|
66
66
|
# before_action :assign_page_title, only: [:show, :update]
|
67
67
|
# Assign page title
|
68
68
|
def assign_page_title
|
69
|
-
@page_title ||= resource_wizard_step_title(step)
|
69
|
+
@page_title ||= resource_wizard_step_title(resource, step)
|
70
70
|
end
|
71
71
|
|
72
72
|
end
|
@@ -20,7 +20,7 @@ module EffectiveResourcesWizardHelper
|
|
20
20
|
def render_wizard_sidebar_item(resource, nav_step, index = nil)
|
21
21
|
# From Controller
|
22
22
|
current = (nav_step == step)
|
23
|
-
title = resource_wizard_step_title(nav_step)
|
23
|
+
title = resource_wizard_step_title(resource, nav_step)
|
24
24
|
|
25
25
|
# From Model
|
26
26
|
disabled = !resource.can_visit_step?(nav_step)
|
@@ -43,6 +43,7 @@ module ActsAsWizard
|
|
43
43
|
wizard_steps[current_step.to_sym] ||= Time.zone.now
|
44
44
|
end
|
45
45
|
|
46
|
+
# Use can_visit_step? required_steps and wizard_step_title(step) to control the wizard behaviour
|
46
47
|
def can_visit_step?(step)
|
47
48
|
can_revisit_completed_steps(step)
|
48
49
|
end
|
@@ -52,6 +53,10 @@ module ActsAsWizard
|
|
52
53
|
self.class.const_get(:WIZARD_STEPS).keys
|
53
54
|
end
|
54
55
|
|
56
|
+
def wizard_step_title(step)
|
57
|
+
self.class.const_get(:WIZARD_STEPS).fetch(step)
|
58
|
+
end
|
59
|
+
|
55
60
|
def first_completed_step
|
56
61
|
required_steps.find { |step| has_completed_step?(step) }
|
57
62
|
end
|