effective_resources 1.8.15 → 1.8.16

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
2
  SHA256:
3
- metadata.gz: f4b28e1caca0bb8019717713f5c76ae4c1b9e8008936450697ff53f9bca96546
4
- data.tar.gz: '09187e5fcec31ad99827706d91a900038097c84579ee701fbafe6efde2dbed7d'
3
+ metadata.gz: a854fdf544ea77faf7d45b251f8161b54ef66685c71730d6b4bdef42298ac371
4
+ data.tar.gz: 22d0141d18a049ed853d2ba54197758e46817ffdf6704c1facee7850cad5bef6
5
5
  SHA512:
6
- metadata.gz: af2652031c87d654fd8ba0210a41893a5eae2fa1a85ff05667b78b36cf0cf51fe01185f6c5d4d6d4ebb36eb8217ec73170a3f24680f19fba6b330b04ee1cf439
7
- data.tar.gz: 651d54db0baf6fd4c6817b1669e9facaecd43b1792fe6a48b96ce9a72ce65f6c430b77665152574e95ebaf786886b78d63374e9cade0113794d0c78b9d824127
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
- effective_resource.klass.const_get(:WIZARD_STEPS).fetch(step)
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
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '1.8.15'.freeze
2
+ VERSION = '1.8.16'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.15
4
+ version: 1.8.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect