effective_resources 1.15.0 → 1.17.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4196a26392312c2343b4ae31d4580a7c8b84a8f37d8e74c77e17d34016314b9c
4
- data.tar.gz: 93d48690d2be56b1f5068bf815055de47446599b82aaf4444e52583208f368b3
3
+ metadata.gz: 89ee5768e0e064df020dfd0da3110e601fa51dd100d10a909442279c5e85465e
4
+ data.tar.gz: 03d67a2c0228472542671b781ba00a16fd3959e541adc4d1e9beeaf3e23d2b58
5
5
  SHA512:
6
- metadata.gz: b25bc7b63e988fe7198cdd2e5b44d79cbee612fb18839b088feb7e3c53c6b00a8c27ac76f0de796278f147e93b27d64f374cae0c00e1419350146243cfc4f9ae
7
- data.tar.gz: 159c99e620737423d67963b28feefa1bda55dfd645a25835892bded90a4d616dd52e659913f3f97f246c6274a5ad5cae615c33d43c795c576a8fe6465235487a
6
+ metadata.gz: 143e22c3e4df4f5937fefd00963d97e483e4d6355ad13367a3a1e64a74c0a32541cd5d2fe3100e728fa839e15ff32dc6f5c4b716ce69dd718b8d53b43a15b899
7
+ data.tar.gz: 2dba5416763bec7476ffd586dbade4dd44fc21eb3112580c09b470eb5bf719a18116294e8f5c2afcb85e80d48a459d80a91734e27f68e342af6a9b7238c7b4da
@@ -48,9 +48,12 @@ module ActsAsPurchasableWizard
48
48
  end
49
49
 
50
50
  def find_or_build_submit_order
51
- order = submit_order || orders.build(user: owner)
51
+ order = submit_order || orders.build(user: owner) # This is polymorphic user, might be an organization
52
52
  fees = submit_fees().reject { |fee| fee.marked_for_destruction? }
53
53
 
54
+ # A membership could go from individual to organization
55
+ order.user = owner
56
+
54
57
  # Adds fees, but does not overwrite any existing price.
55
58
  fees.each do |fee|
56
59
  order.add(fee) unless order.purchasables.include?(fee)
@@ -56,7 +56,23 @@ module ActsAsWizard
56
56
 
57
57
  def required_steps
58
58
  return self.class.test_required_steps if Rails.env.test? && self.class.test_required_steps.present?
59
- wizard_step_keys()
59
+
60
+ steps = wizard_step_keys()
61
+
62
+ # Give the caller class a mechanism to change these.
63
+ # Used more in effective memberships
64
+ steps = change_wizard_steps(steps)
65
+
66
+ unless steps.kind_of?(Array) && steps.all? { |step| step.kind_of?(Symbol) }
67
+ raise('expected change_wizard_steps to return an Array of steps with no nils')
68
+ end
69
+
70
+ steps
71
+ end
72
+
73
+ # Intended for use by calling class
74
+ def change_wizard_steps(steps)
75
+ steps
60
76
  end
61
77
 
62
78
  # For use in the summary partials. Does not include summary.
@@ -47,7 +47,6 @@ module Effective
47
47
  action_name = action.to_s.titleize
48
48
 
49
49
  if action == :destroy
50
- next if buttons.values.find { |v| v[:action] == :archive }.present?
51
50
  buttons['Delete'] = { action: action, default: true, 'data-method' => :delete, 'data-confirm' => "Really delete @resource?" }
52
51
  else
53
52
  buttons[action_name] = { action: action, default: true, 'data-method' => :delete, 'data-confirm' => "Really #{action_name} @resource?" }
@@ -101,7 +100,6 @@ module Effective
101
100
  action_name = action.to_s.titleize
102
101
 
103
102
  if action == :destroy
104
- next if actions.find { |_, v| v[:action] == :archive }.present?
105
103
  actions['Delete'] = { action: action, default: true, 'data-method' => :delete, 'data-confirm' => "Really delete @resource?" }
106
104
  else
107
105
  actions[action_name] = { action: action, default: true, 'data-method' => :delete, 'data-confirm' => "Really #{action_name} @resource?" }
@@ -57,11 +57,9 @@ module EffectiveResources
57
57
  # Register the acts_as_archived routes concern
58
58
  # resources :things, concerns: :acts_as_archived
59
59
  initializer 'effective_resources.routes_concern' do |app|
60
- ActionDispatch::Routing::Mapper.include(ActsAsArchived::RoutesConcern)
61
-
62
- # Doesn't seem to work with the on_load in rails 6.0
63
- #ActiveSupport.on_load :action_controller_base do
64
- #end
60
+ app.config.to_prepare do
61
+ ActionDispatch::Routing::Mapper.include(ActsAsArchived::RoutesConcern)
62
+ end
65
63
  end
66
64
 
67
65
  # Register the flash_messages concern so that it can be called in ActionController
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '1.15.0'.freeze
2
+ VERSION = '1.17.0'.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.15.0
4
+ version: 1.17.0
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: 2022-03-04 00:00:00.000000000 Z
11
+ date: 2022-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails