effective_resources 2.20.5 → 2.20.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/admin/select2_ajax_controller.rb +0 -12
- data/app/controllers/concerns/effective/select2_ajax_controller.rb +12 -2
- data/app/models/concerns/acts_as_purchasable_wizard.rb +39 -2
- data/app/models/concerns/acts_as_wizard.rb +1 -1
- 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: 69e89a1c84cc396ff530fdc93cd65fbefad6ea5ae8ffb2058f67d75fd10b6cc4
|
4
|
+
data.tar.gz: 35c4dcec9220fa6b88eea8fa9877c1e9d793b5ccec1763a58c0fad399b5cf0bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3b93da68c46b5cbdf3c558b77d53e9c69012d4c41db6632821be08affac220c1c5601087cb7b52ebb92011e63c5ece1fd57749812a75b6efdb798c28c82d23c
|
7
|
+
data.tar.gz: 53c3c00d8f29414894aa61865fc64fa6d895f3540b44ce101c229d8a865caceed72b508097dbd57dced9fbf3fa348d2b42764aa10ac8b84d935a34204b456330
|
@@ -37,17 +37,5 @@ module Admin
|
|
37
37
|
{ id: organization.to_param, text: organization.try(:to_select2) || to_select2(organization) }
|
38
38
|
end
|
39
39
|
end
|
40
|
-
|
41
|
-
private
|
42
|
-
|
43
|
-
def to_select2(resource)
|
44
|
-
if resource.try(:email).present?
|
45
|
-
"<span>#{resource}</span> <small>#{resource.email}</small>"
|
46
|
-
else
|
47
|
-
"<span>#{resource}</span>"
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
40
|
end
|
52
|
-
|
53
41
|
end
|
@@ -2,11 +2,11 @@ module Effective
|
|
2
2
|
module Select2AjaxController
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
|
-
def respond_with_select2_ajax(collection, skip_search: false, &block)
|
5
|
+
def respond_with_select2_ajax(collection, skip_search: false, skip_authorize: false, &block)
|
6
6
|
raise('collection should be an ActiveRecord::Relation') unless collection.kind_of?(ActiveRecord::Relation)
|
7
7
|
|
8
8
|
# Authorize
|
9
|
-
EffectiveResources.authorize!(self, :index, collection.klass)
|
9
|
+
EffectiveResources.authorize!(self, :index, collection.klass) unless skip_authorize
|
10
10
|
|
11
11
|
# Scope
|
12
12
|
if collection.respond_to?(:select2_ajax)
|
@@ -49,5 +49,15 @@ module Effective
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
+
private
|
53
|
+
|
54
|
+
def to_select2(resource)
|
55
|
+
if resource.try(:email).present?
|
56
|
+
"<span>#{resource}</span> <small>#{resource.email}</small>"
|
57
|
+
else
|
58
|
+
"<span>#{resource}</span>"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
52
62
|
end
|
53
63
|
end
|
@@ -26,6 +26,13 @@ module ActsAsPurchasableWizard
|
|
26
26
|
self.errors.add(:base, "must have an email") unless owner.email.present?
|
27
27
|
end
|
28
28
|
|
29
|
+
after_defer do |_|
|
30
|
+
raise('expected submit_order to be deferred') unless submit_order&.deferred?
|
31
|
+
before_submit_deferred!
|
32
|
+
submit_deferred!
|
33
|
+
after_submit_deferred!
|
34
|
+
end
|
35
|
+
|
29
36
|
after_purchase do |_|
|
30
37
|
raise('expected submit_order to be purchased') unless submit_order&.purchased?
|
31
38
|
before_submit_purchased!
|
@@ -180,9 +187,34 @@ module ActsAsPurchasableWizard
|
|
180
187
|
end
|
181
188
|
end
|
182
189
|
|
190
|
+
# The historic way of handling a deferred order checkout is to return to the :checkout step and not call wizard submit!
|
191
|
+
# With effective_events date delayed payments, we do call wizard submit! and proceed to the :submitted step.
|
192
|
+
|
193
|
+
# False by default - do not call submit
|
194
|
+
def submit_wizard_on_deferred_order?
|
195
|
+
false
|
196
|
+
end
|
197
|
+
|
198
|
+
# Called automatically via after_defer hook above
|
199
|
+
def submit_deferred!
|
200
|
+
return unless submit_wizard_on_deferred_order?
|
201
|
+
return false if was_submitted?
|
202
|
+
|
203
|
+
wizard_steps[:checkout] = Time.zone.now
|
204
|
+
submit!
|
205
|
+
end
|
206
|
+
|
207
|
+
# A hook to extend
|
208
|
+
def before_submit_deferred!
|
209
|
+
end
|
210
|
+
|
211
|
+
def after_submit_deferred!
|
212
|
+
end
|
213
|
+
|
183
214
|
# Called automatically via after_purchase hook above
|
215
|
+
# If previously submitted, possibly with deferred order, just save so any before_save or validate can run.
|
184
216
|
def submit_purchased!
|
185
|
-
return
|
217
|
+
return save! if was_submitted?
|
186
218
|
|
187
219
|
wizard_steps[:checkout] = Time.zone.now
|
188
220
|
submit!
|
@@ -198,7 +230,12 @@ module ActsAsPurchasableWizard
|
|
198
230
|
# Draft -> Submitted requirements
|
199
231
|
def submit!
|
200
232
|
raise('already submitted') if was_submitted?
|
201
|
-
|
233
|
+
|
234
|
+
if submit_wizard_on_deferred_order?
|
235
|
+
raise('expected a purchased or deferred order') unless (submit_order&.purchased? || submit_order&.deferred?)
|
236
|
+
else
|
237
|
+
raise('expected a purchased order') unless submit_order&.purchased?
|
238
|
+
end
|
202
239
|
|
203
240
|
wizard_steps[:checkout] ||= Time.zone.now
|
204
241
|
wizard_steps[:submitted] = Time.zone.now
|
@@ -113,7 +113,7 @@ module ActsAsWizard
|
|
113
113
|
|
114
114
|
# For use in the summary partials. Does not include summary.
|
115
115
|
def render_steps
|
116
|
-
blacklist = [:start, :billing, :checkout, :submit, :submitted, :summary]
|
116
|
+
blacklist = [:start, :billing, :checkout, :submit, :submitted, :complete, :completed, :summary]
|
117
117
|
((required_steps | completed_steps) - blacklist).select { |step| has_completed_step?(step) }
|
118
118
|
end
|
119
119
|
|
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: 2.20.
|
4
|
+
version: 2.20.7
|
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: 2024-05-
|
11
|
+
date: 2024-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|