effective_resources 1.8.28 → 1.8.32

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: 841e6d1f903229208d1ad3b881b7fe32b75a851a28a3b2d0b8cea6062fac9afb
4
- data.tar.gz: ddea9ed6121e5b34c35227bff21714f15a245bd73018531a265d281a289bcbae
3
+ metadata.gz: d4947c3721a74b21dbbda376785836f0ee3555615d56ff0f4850525b17f49d8c
4
+ data.tar.gz: c70ce7a422d7c99e0ec304955cb33d528ad9d7ab0466222e94d8ec9a958442a0
5
5
  SHA512:
6
- metadata.gz: bd5f342a636e0beb84070ed95f0580dd94c1e8ec9a5ca1a6d6f8b155eef1198bf2dffb16f5da707727f33b3706467890581a8d560a5f027ebff7c6b6679f073d
7
- data.tar.gz: 48cc4045db4e741cfe9c457cee3d7b38d464e4631d347a9e1dea118b7de62aa768145682f7c9accc1b0e5d9c36b60b289ee105f9e8e150b6fbcecc72492e97a7
6
+ metadata.gz: 690b5ebefd83b651f35e586d596ebc470c05beb4bc871e71cbc711ad331ddf004cf2a22d825c37d03d25ce5edc290c14fe00d8785b2881a6557f21edf6b34c73
7
+ data.tar.gz: 0c727005edcc162ffe64c8368fd5ba95ca2ff84e5d0073f24177cf521a9540343bd82897efee8d43c09917d111a74b58e51b767c434bd4f044963fc3b4c2b3c5
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(:new, resource.first_uncompleted_step || resource_wizard_steps.first)
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.required_steps.find { |s| s == next_step } || resource.first_uncompleted_step
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
@@ -2,8 +2,10 @@
2
2
 
3
3
  module EffectiveResourcesWizardHelper
4
4
 
5
- def render_wizard_sidebar(resource, numbers: true, &block)
6
- sidebar = content_tag(:div, class: 'nav list-group wizard-sidebar') do
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 'acts_as_sluggable' make sure you have a string field :slug
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
@@ -25,6 +25,8 @@ module ActsAsWizard
25
25
  acts_as_wizard_options = @acts_as_wizard_options
26
26
 
27
27
  attr_accessor :current_step
28
+ attr_accessor :skip_to_step
29
+
28
30
  attr_accessor :current_user
29
31
 
30
32
  if Rails.env.test? # So our tests can override the required_steps method
@@ -39,9 +39,9 @@ module HasManyRichTexts
39
39
  end
40
40
 
41
41
  def method_missing(method, *args, &block)
42
- method = method.to_s
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?('=')
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '1.8.28'.freeze
2
+ VERSION = '1.8.32'.freeze
3
3
  end
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.28
4
+ version: 1.8.32
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-09-09 00:00:00.000000000 Z
11
+ date: 2021-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails