effective_resources 1.9.17 → 1.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/effective_resources_wizard_helper.rb +4 -4
- data/app/models/concerns/acts_as_purchasable_wizard.rb +4 -3
- data/app/views/layouts/effective_mailer_layout.html.haml +7 -0
- data/config/effective_resources.rb +20 -0
- data/lib/effective_resources/effective_gem.rb +10 -0
- data/lib/effective_resources/version.rb +1 -1
- data/lib/effective_resources.rb +29 -5
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 536afe56ae331c14920c56f2eb625812127f0b0ad9f57696b8dce9cc198b6840
|
4
|
+
data.tar.gz: 99afc3984fd065ae8014bb031ea16a9138fce77e3ec0861b140a7d18e6f5e5fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd3e83bde7a2a01e86e9588d1998249c5e1f8882bceb679e4c32d4bafbb409b419125cc7bcca2ab4fe358bce0e707f79f7f1a5f1ef4628228dc897a9c74ca510
|
7
|
+
data.tar.gz: 659aab8c923fd9a5b33cb21335251c038f7af37e141c5312fea317bf0a2a9fbb2f673a12cec5b8170a3e57a50e27dcaec21a76af4b69bfdb0143ea7fdcced82b
|
@@ -14,8 +14,8 @@ module EffectiveResourcesWizardHelper
|
|
14
14
|
return sidebar unless block_given?
|
15
15
|
|
16
16
|
content_tag(:div, class: 'row') do
|
17
|
-
content_tag(:div, class: 'col-3') { sidebar } +
|
18
|
-
content_tag(:div, class: 'col-9') { yield }
|
17
|
+
content_tag(:div, class: 'col-lg-3') { sidebar } +
|
18
|
+
content_tag(:div, class: 'col-lg-9') { yield }
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -28,10 +28,10 @@ module EffectiveResourcesWizardHelper
|
|
28
28
|
disabled = !resource.can_visit_step?(nav_step)
|
29
29
|
|
30
30
|
label = [index, title].compact.join('. ')
|
31
|
-
klass = ['list-group-item', ('active' if current), ('disabled' if disabled && !current)].compact.join(' ')
|
31
|
+
klass = ['list-group-item', 'list-group-item-action', ('active' if current), ('disabled' if disabled && !current)].compact.join(' ')
|
32
32
|
|
33
33
|
if (current || disabled)
|
34
|
-
content_tag(:
|
34
|
+
content_tag(:a, label, class: klass)
|
35
35
|
else
|
36
36
|
link_to(label, wizard_path(nav_step), class: klass)
|
37
37
|
end
|
@@ -49,15 +49,16 @@ module ActsAsPurchasableWizard
|
|
49
49
|
|
50
50
|
def find_or_build_submit_order
|
51
51
|
order = submit_order || orders.build(user: owner)
|
52
|
-
fees = submit_fees()
|
52
|
+
fees = submit_fees().reject { |fee| fee.marked_for_destruction? }
|
53
53
|
|
54
54
|
# Adds fees, but does not overwrite any existing price.
|
55
55
|
fees.each do |fee|
|
56
56
|
order.add(fee) unless order.purchasables.include?(fee)
|
57
57
|
end
|
58
58
|
|
59
|
-
order.
|
60
|
-
|
59
|
+
order.order_items.each do |order_item|
|
60
|
+
fee = fees.find { |fee| fee == order_item.purchasable }
|
61
|
+
order.remove(order_item) unless fee.present?
|
61
62
|
end
|
62
63
|
|
63
64
|
# From Billing Step
|
@@ -21,6 +21,8 @@ EffectiveResources.setup do |config|
|
|
21
21
|
# end
|
22
22
|
config.authorization_method = Proc.new { |controller, action, resource| authorize!(action, resource) }
|
23
23
|
|
24
|
+
# Default Submits
|
25
|
+
#
|
24
26
|
# These default submit actions will be added to each controller
|
25
27
|
# and rendered when calling effective_submit(f)
|
26
28
|
# based on the controller, and its `submits` if any.
|
@@ -28,4 +30,22 @@ EffectiveResources.setup do |config|
|
|
28
30
|
# Supported values: 'Save', 'Continue', and 'Add New'
|
29
31
|
config.default_submits = ['Save', 'Continue', 'Add New']
|
30
32
|
|
33
|
+
# Email Settings
|
34
|
+
#
|
35
|
+
# The default mailer settings for all effective gems
|
36
|
+
#
|
37
|
+
# Configure the parent class responsible to send e-mails.
|
38
|
+
# config.parent_mailer = '::ApplicationMailer'
|
39
|
+
|
40
|
+
# Default deliver method
|
41
|
+
# config.deliver_method = :deliver_now
|
42
|
+
|
43
|
+
# Default layout
|
44
|
+
# config.mailer_layout = 'effective_mailer_layout'
|
45
|
+
|
46
|
+
# Default From
|
47
|
+
config.mailer_sender = "no-reply@example.com"
|
48
|
+
|
49
|
+
# Send Admin correspondence To
|
50
|
+
config.mailer_admin = "admin@example.com"
|
31
51
|
end
|
@@ -38,6 +38,16 @@ module EffectiveGem
|
|
38
38
|
|
39
39
|
true
|
40
40
|
end
|
41
|
+
|
42
|
+
# This is included into every gem
|
43
|
+
# The gem may not have a mailer or use effective email templates
|
44
|
+
def send_email(email, *args)
|
45
|
+
raise('gem does not respond to mailer_class') unless respond_to?(:mailer_class)
|
46
|
+
raise('expected args to be an Array') unless args.kind_of?(Array)
|
47
|
+
|
48
|
+
mailer_class.send(email, *args).send(EffectiveResources.deliver_method)
|
49
|
+
end
|
50
|
+
|
41
51
|
end
|
42
52
|
|
43
53
|
end
|
data/lib/effective_resources.rb
CHANGED
@@ -5,7 +5,10 @@ require 'effective_resources/effective_gem'
|
|
5
5
|
module EffectiveResources
|
6
6
|
|
7
7
|
def self.config_keys
|
8
|
-
[
|
8
|
+
[
|
9
|
+
:authorization_method, :default_submits,
|
10
|
+
:deliver_method, :mailer_layout, :mailer_sender, :mailer_admin, :parent_mailer
|
11
|
+
]
|
9
12
|
end
|
10
13
|
|
11
14
|
include EffectiveGem
|
@@ -31,6 +34,31 @@ module EffectiveResources
|
|
31
34
|
(['Save', 'Continue', 'Add New'] & Array(config.default_submits)).inject({}) { |h, v| h[v] = true; h }
|
32
35
|
end
|
33
36
|
|
37
|
+
# Email
|
38
|
+
def self.deliver_method
|
39
|
+
return config[:deliver_method] if config[:deliver_method].present?
|
40
|
+
|
41
|
+
rails = Rails.application.config
|
42
|
+
(rails.respond_to?(:active_job) && rails.active_job.queue_adapter) ? :deliver_later : :deliver_now
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.mailer_layout
|
46
|
+
config[:mailer_layout] || 'effective_mailer_layout'
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.mailer_sender
|
50
|
+
config[:mailer_sender] || raise('effective resources mailer_sender missing. Add it to config/initializers/effective_resources.rb')
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.mailer_admin
|
54
|
+
config[:mailer_admin] || raise('effective resources mailer_admin missing. Add it to config/initializers/effective_resources.rb')
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.parent_mailer_class
|
58
|
+
return config[:parent_mailer].constantize if config[:parent_mailer].present?
|
59
|
+
'::ApplicationMailer'.safe_constantize || 'ActionMailer::Base'.constantize
|
60
|
+
end
|
61
|
+
|
34
62
|
# Utilities
|
35
63
|
|
36
64
|
# This looks up the best class give the name
|
@@ -81,10 +109,6 @@ module EffectiveResources
|
|
81
109
|
end
|
82
110
|
end
|
83
111
|
|
84
|
-
def self.deliver_method
|
85
|
-
config = Rails.application.config
|
86
|
-
(config.respond_to?(:active_job) && config.active_job.queue_adapter) ? :deliver_later : :deliver_now
|
87
|
-
end
|
88
112
|
|
89
113
|
def self.advance_date(date, business_days: 1, holidays: [:ca, :observed])
|
90
114
|
raise('business_days must be an integer <= 365') unless business_days.kind_of?(Integer) && business_days <= 365
|
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.
|
4
|
+
version: 1.10.1
|
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-01-
|
11
|
+
date: 2022-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -202,6 +202,7 @@ files:
|
|
202
202
|
- app/views/effective/resource/_actions.html.haml
|
203
203
|
- app/views/effective/resource/_actions_dropleft.html.haml
|
204
204
|
- app/views/effective/resource/_actions_glyphicons.html.haml
|
205
|
+
- app/views/layouts/effective_mailer_layout.html.haml
|
205
206
|
- config/effective_resources.rb
|
206
207
|
- lib/effective_resources.rb
|
207
208
|
- lib/effective_resources/effective_gem.rb
|