effective_cpd 0.2.1 → 0.3.2
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 +4 -4
- data/app/mailers/effective/cpd_mailer.rb +139 -67
- data/app/models/effective/cpd_audit.rb +6 -3
- data/app/views/admin/cpd_audits/_form.html.haml +3 -0
- data/app/views/admin/cpd_audits/_form_deadlines.html.haml +12 -0
- data/app/views/effective/cpd_audits/complete.html.haml +16 -15
- data/app/views/effective/cpd_audits/conflict.html.haml +1 -1
- data/app/views/effective/cpd_audits/exemption.html.haml +1 -1
- data/app/views/effective/cpd_audits/extension.html.haml +1 -1
- data/config/effective_cpd.rb +16 -22
- data/db/migrate/01_create_effective_cpd.rb.erb +2 -0
- data/lib/effective_cpd/version.rb +1 -1
- data/lib/effective_cpd.rb +2 -31
- metadata +3 -3
- data/app/views/layouts/effective_cpd_mailer_layout.html.haml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf98009925976387ffeafade80664bc5b17f9790b7172d0be90b84ed0ee86707
|
4
|
+
data.tar.gz: 073aa23104da3dbbf673798f27a6ffe80ea999b34fdc6df9cd7d08b5765897ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0b842326dc273ea10fe3232bbaea3266dd3ca43f248e0798fb5cee1db386da08befaa56f8880fcc43b5558d039926a9823000ea293d2d71f06f2e4dee9fa978
|
7
|
+
data.tar.gz: efb3b2c91cbf7976156f8bc169fd7f483399f10894a335b0a936cfd75f0235350d6af3e79e846ee22f40c6b91ed3f3c891cefe931b7212057073c5fcec2d5055
|
@@ -1,122 +1,194 @@
|
|
1
1
|
module Effective
|
2
2
|
class CpdMailer < EffectiveCpd.parent_mailer_class
|
3
|
-
|
4
|
-
|
3
|
+
|
4
|
+
include EffectiveMailer
|
5
|
+
include EffectiveEmailTemplatesMailer if EffectiveCpd.use_effective_email_templates
|
5
6
|
|
6
7
|
# CPD Audit
|
7
|
-
def cpd_audit_opened(
|
8
|
-
|
9
|
-
|
8
|
+
def cpd_audit_opened(resource, opts = {})
|
9
|
+
raise('expected an Effective::CpdAudit') unless resource.kind_of?(Effective::CpdAudit)
|
10
|
+
|
11
|
+
@assigns = assigns_for(resource).merge(url: effective_cpd.cpd_audit_url(resource))
|
12
|
+
@cpd_audit = resource
|
13
|
+
|
14
|
+
subject = subject_for(__method__, 'CPD Audit Opened', resource, opts)
|
15
|
+
headers = headers_for(resource, opts)
|
10
16
|
|
11
|
-
mail(to:
|
17
|
+
mail(to: resource.user.email, subject: subject, **headers)
|
12
18
|
end
|
13
19
|
|
14
|
-
def cpd_audit_conflicted(
|
15
|
-
|
16
|
-
|
20
|
+
def cpd_audit_conflicted(resource, opts = {})
|
21
|
+
raise('expected an Effective::CpdAudit') unless resource.kind_of?(Effective::CpdAudit)
|
22
|
+
|
23
|
+
@assigns = assigns_for(resource).merge(url: effective_cpd.edit_admin_cpd_audit_url(resource))
|
24
|
+
@cpd_audit = resource
|
25
|
+
|
26
|
+
subject = subject_for(__method__, 'CPD Audit Conflicted', resource, opts)
|
27
|
+
headers = headers_for(resource, opts)
|
17
28
|
|
18
|
-
mail(to:
|
29
|
+
mail(to: mailer_admin, subject: subject, **headers)
|
19
30
|
end
|
20
31
|
|
21
|
-
def cpd_audit_conflict_resolved(
|
22
|
-
|
23
|
-
@assigns.merge!(url: effective_cpd.cpd_audit_url(cpd_audit))
|
32
|
+
def cpd_audit_conflict_resolved(resource, opts = {})
|
33
|
+
raise('expected an Effective::CpdAudit') unless resource.kind_of?(Effective::CpdAudit)
|
24
34
|
|
25
|
-
|
35
|
+
@assigns = assigns_for(resource).merge(url: effective_cpd.cpd_audit_url(resource))
|
36
|
+
@cpd_audit = resource
|
37
|
+
|
38
|
+
subject = subject_for(__method__, 'CPD Audit Conflict Resolved', resource, opts)
|
39
|
+
headers = headers_for(resource, opts)
|
40
|
+
|
41
|
+
mail(to: resource.user.email, subject: subject, **headers)
|
26
42
|
end
|
27
43
|
|
28
|
-
def cpd_audit_exemption_request(
|
29
|
-
|
30
|
-
|
44
|
+
def cpd_audit_exemption_request(resource, opts = {})
|
45
|
+
raise('expected an Effective::CpdAudit') unless resource.kind_of?(Effective::CpdAudit)
|
46
|
+
|
47
|
+
@assigns = assigns_for(resource).merge(url: effective_cpd.edit_admin_cpd_audit_url(resource))
|
48
|
+
@cpd_audit = resource
|
49
|
+
|
50
|
+
subject = subject_for(__method__, 'CPD Audit Exemption Request', resource, opts)
|
51
|
+
headers = headers_for(resource, opts)
|
31
52
|
|
32
|
-
mail(to:
|
53
|
+
mail(to: mailer_admin, subject: subject, **headers)
|
33
54
|
end
|
34
55
|
|
35
|
-
def cpd_audit_exemption_denied(
|
36
|
-
|
37
|
-
@assigns.merge!(url: effective_cpd.cpd_audit_url(cpd_audit))
|
56
|
+
def cpd_audit_exemption_denied(resource, opts = {})
|
57
|
+
raise('expected an Effective::CpdAudit') unless resource.kind_of?(Effective::CpdAudit)
|
38
58
|
|
39
|
-
|
59
|
+
@assigns = assigns_for(resource).merge(url: effective_cpd.cpd_audit_url(resource))
|
60
|
+
@cpd_audit = resource
|
61
|
+
|
62
|
+
subject = subject_for(__method__, 'CPD Audit Exemption Denied', resource, opts)
|
63
|
+
headers = headers_for(resource, opts)
|
64
|
+
|
65
|
+
mail(to: resource.user.email, subject: subject, **headers)
|
40
66
|
end
|
41
67
|
|
42
|
-
def cpd_audit_exemption_granted(
|
43
|
-
|
44
|
-
|
68
|
+
def cpd_audit_exemption_granted(resource, opts = {})
|
69
|
+
raise('expected an Effective::CpdAudit') unless resource.kind_of?(Effective::CpdAudit)
|
70
|
+
|
71
|
+
@assigns = assigns_for(resource).merge(url: effective_cpd.cpd_audit_url(resource))
|
72
|
+
@cpd_audit = resource
|
73
|
+
|
74
|
+
subject = subject_for(__method__, 'CPD Audit Exemption Granted', resource, opts)
|
75
|
+
headers = headers_for(resource, opts)
|
45
76
|
|
46
|
-
mail(to:
|
77
|
+
mail(to: resource.user.email, subject: subject, **headers)
|
47
78
|
end
|
48
79
|
|
49
|
-
def cpd_audit_extension_request(
|
50
|
-
|
51
|
-
@assigns.merge!(url: effective_cpd.edit_admin_cpd_audit_url(cpd_audit))
|
80
|
+
def cpd_audit_extension_request(resource, opts = {})
|
81
|
+
raise('expected an Effective::CpdAudit') unless resource.kind_of?(Effective::CpdAudit)
|
52
82
|
|
53
|
-
|
83
|
+
@assigns = assigns_for(resource).merge(url: effective_cpd.edit_admin_cpd_audit_url(resource))
|
84
|
+
@cpd_audit = resource
|
85
|
+
|
86
|
+
subject = subject_for(__method__, 'CPD Audit Extension Request', resource, opts)
|
87
|
+
headers = headers_for(resource, opts)
|
88
|
+
|
89
|
+
mail(to: mailer_admin, subject: subject, **headers)
|
54
90
|
end
|
55
91
|
|
56
|
-
def cpd_audit_extension_denied(
|
57
|
-
|
58
|
-
|
92
|
+
def cpd_audit_extension_denied(resource, opts = {})
|
93
|
+
raise('expected an Effective::CpdAudit') unless resource.kind_of?(Effective::CpdAudit)
|
94
|
+
|
95
|
+
@assigns = assigns_for(resource).merge(url: effective_cpd.cpd_audit_url(resource))
|
96
|
+
@cpd_audit = resource
|
97
|
+
|
98
|
+
subject = subject_for(__method__, 'CPD Audit Extension Denied', resource, opts)
|
99
|
+
headers = headers_for(resource, opts)
|
59
100
|
|
60
|
-
mail(to:
|
101
|
+
mail(to: resource.user.email, subject: subject, **headers)
|
61
102
|
end
|
62
103
|
|
63
|
-
def cpd_audit_extension_granted(
|
64
|
-
|
65
|
-
@assigns.merge!(url: effective_cpd.cpd_audit_url(cpd_audit))
|
104
|
+
def cpd_audit_extension_granted(resource, opts = {})
|
105
|
+
raise('expected an Effective::CpdAudit') unless resource.kind_of?(Effective::CpdAudit)
|
66
106
|
|
67
|
-
|
107
|
+
@assigns = assigns_for(resource).merge(url: effective_cpd.cpd_audit_url(resource))
|
108
|
+
@cpd_audit = resource
|
109
|
+
|
110
|
+
subject = subject_for(__method__, 'CPD Audit Extension Granted', resource, opts)
|
111
|
+
headers = headers_for(resource, opts)
|
112
|
+
|
113
|
+
mail(to: resource.user.email, subject: subject, **headers)
|
68
114
|
end
|
69
115
|
|
70
|
-
def cpd_audit_submitted(
|
71
|
-
|
72
|
-
|
116
|
+
def cpd_audit_submitted(resource, opts = {})
|
117
|
+
raise('expected an Effective::CpdAudit') unless resource.kind_of?(Effective::CpdAudit)
|
118
|
+
|
119
|
+
@assigns = assigns_for(resource).merge(url: effective_cpd.edit_admin_cpd_audit_url(resource))
|
120
|
+
@cpd_audit = resource
|
121
|
+
|
122
|
+
subject = subject_for(__method__, 'CPD Audit Submitted', resource, opts)
|
123
|
+
headers = headers_for(resource, opts)
|
73
124
|
|
74
|
-
mail(to:
|
125
|
+
mail(to: mailer_admin, subject: subject, **headers)
|
75
126
|
end
|
76
127
|
|
77
|
-
def cpd_audit_reviewed(
|
78
|
-
|
79
|
-
@assigns.merge!(url: effective_cpd.edit_admin_cpd_audit_url(cpd_audit))
|
128
|
+
def cpd_audit_reviewed(resource, opts = {})
|
129
|
+
raise('expected an Effective::CpdAudit') unless resource.kind_of?(Effective::CpdAudit)
|
80
130
|
|
81
|
-
|
131
|
+
@assigns = assigns_for(resource).merge(url: effective_cpd.edit_admin_cpd_audit_url(resource))
|
132
|
+
@cpd_audit = resource
|
133
|
+
|
134
|
+
subject = subject_for(__method__, 'CPD Audit Reviewed', resource, opts)
|
135
|
+
headers = headers_for(resource, opts)
|
136
|
+
|
137
|
+
mail(to: mailer_admin, subject: subject, **headers)
|
82
138
|
end
|
83
139
|
|
84
|
-
def cpd_audit_closed(
|
85
|
-
|
86
|
-
|
140
|
+
def cpd_audit_closed(resource, opts = {})
|
141
|
+
raise('expected an Effective::CpdAudit') unless resource.kind_of?(Effective::CpdAudit)
|
142
|
+
|
143
|
+
@assigns = assigns_for(resource).merge(url: effective_cpd.cpd_audit_url(resource))
|
144
|
+
@cpd_audit = resource
|
145
|
+
|
146
|
+
subject = subject_for(__method__, 'CPD Audit Closed', resource, opts)
|
147
|
+
headers = headers_for(resource, opts)
|
87
148
|
|
88
|
-
mail(to:
|
149
|
+
mail(to: resource.user.email, subject: subject, **headers)
|
89
150
|
end
|
90
151
|
|
91
152
|
# CPD Audit Review
|
92
|
-
def cpd_audit_review_opened(
|
93
|
-
|
94
|
-
@assigns.merge!(url: effective_cpd.cpd_audit_review_url(cpd_audit_review))
|
153
|
+
def cpd_audit_review_opened(resource, opts = {})
|
154
|
+
raise('expected an Effective::CpdAuditReview') unless resource.kind_of?(Effective::CpdAuditReview)
|
95
155
|
|
96
|
-
|
97
|
-
|
156
|
+
@assigns = assigns_for(resource).merge(url: effective_cpd.cpd_audit_review_url(resource))
|
157
|
+
@cpd_audit_review = resource
|
98
158
|
|
99
|
-
|
100
|
-
|
101
|
-
@assigns.merge!(url: effective_cpd.cpd_audit_review_url(cpd_audit_review))
|
159
|
+
subject = subject_for(__method__, 'CPD Audit Review Opened', resource, opts)
|
160
|
+
headers = headers_for(resource, opts)
|
102
161
|
|
103
|
-
mail(to:
|
162
|
+
mail(to: resource.user.email, subject: subject, **headers)
|
104
163
|
end
|
105
164
|
|
106
|
-
def
|
107
|
-
|
108
|
-
|
165
|
+
def cpd_audit_review_ready(resource, opts = {})
|
166
|
+
raise('expected an Effective::CpdAuditReview') unless resource.kind_of?(Effective::CpdAuditReview)
|
167
|
+
|
168
|
+
@assigns = assigns_for(resource).merge(url: effective_cpd.cpd_audit_review_url(resource))
|
169
|
+
@cpd_audit_review = resource
|
109
170
|
|
110
|
-
|
171
|
+
subject = subject_for(__method__, 'CPD Audit Review Ready', resource, opts)
|
172
|
+
headers = headers_for(resource, opts)
|
173
|
+
|
174
|
+
mail(to: resource.user.email, subject: subject, **headers)
|
111
175
|
end
|
112
176
|
|
113
|
-
|
177
|
+
def cpd_audit_review_submitted(resource, opts = {})
|
178
|
+
raise('expected an Effective::CpdAuditReview') unless resource.kind_of?(Effective::CpdAuditReview)
|
114
179
|
|
115
|
-
|
116
|
-
|
180
|
+
@assigns = assigns_for(resource).merge(url: effective_cpd.edit_admin_cpd_audit_url(resource.cpd_audit))
|
181
|
+
@cpd_audit_review = resource
|
182
|
+
|
183
|
+
subject = subject_for(__method__, 'CPD Audit Review Submitted', resource, opts)
|
184
|
+
headers = headers_for(resource, opts)
|
185
|
+
|
186
|
+
mail(to: mailer_admin, subject: subject, **headers)
|
117
187
|
end
|
118
188
|
|
119
|
-
|
189
|
+
protected
|
190
|
+
|
191
|
+
def assigns_for(resource)
|
120
192
|
unless resource.kind_of?(Effective::CpdAudit) || resource.kind_of?(Effective::CpdAuditReview)
|
121
193
|
raise('expected an Effective::CpdAudit or Effective::CpdAuditReview')
|
122
194
|
end
|
@@ -76,6 +76,9 @@ module Effective
|
|
76
76
|
# Final determination
|
77
77
|
determination :string
|
78
78
|
|
79
|
+
# Override Deadlines
|
80
|
+
ignore_deadlines :boolean
|
81
|
+
|
79
82
|
# Auditee response
|
80
83
|
conflict_of_interest :boolean
|
81
84
|
conflict_of_interest_reason :text
|
@@ -130,17 +133,17 @@ module Effective
|
|
130
133
|
validates :extension_request_date, presence: true, if: -> { extension_request? }
|
131
134
|
validates :extension_request_reason, presence: true, if: -> { extension_request? }
|
132
135
|
|
133
|
-
validate(if: -> { current_step == :conflict && conflict_of_interest? }) do
|
136
|
+
validate(if: -> { current_step == :conflict && conflict_of_interest? && !ignore_deadlines? }) do
|
134
137
|
deadline = deadline_to_conflict_of_interest()
|
135
138
|
self.errors.add(:base, 'deadline to declare conflict of interest has already passed') if deadline && deadline < Time.zone.now
|
136
139
|
end
|
137
140
|
|
138
|
-
validate(if: -> { current_step == :exemption && exemption_request? }) do
|
141
|
+
validate(if: -> { current_step == :exemption && exemption_request? && !ignore_deadlines? }) do
|
139
142
|
deadline = deadline_to_exemption()
|
140
143
|
self.errors.add(:base, 'deadline to request exemption has already passed') if deadline && deadline < Time.zone.now
|
141
144
|
end
|
142
145
|
|
143
|
-
validate(if: -> { current_step == :extension && extension_request? }) do
|
146
|
+
validate(if: -> { current_step == :extension && extension_request? && !ignore_deadlines? }) do
|
144
147
|
deadline = deadline_to_extension()
|
145
148
|
self.errors.add(:base, 'deadline to request extension has already passed') if deadline && deadline < Time.zone.now
|
146
149
|
end
|
@@ -17,6 +17,9 @@
|
|
17
17
|
= tab 'Audit' do
|
18
18
|
= render 'effective/cpd_audits/cpd_audit', cpd_audit: cpd_audit
|
19
19
|
|
20
|
+
= tab 'Deadlines' do
|
21
|
+
= render 'admin/cpd_audits/form_deadlines', cpd_audit: cpd_audit
|
22
|
+
|
20
23
|
= tab 'Statements' do
|
21
24
|
- datatable = Admin::EffectiveCpdStatementsDatatable.new(user_id: cpd_audit.user.id, user_type: cpd_audit.user.class.name)
|
22
25
|
= render_datatable(datatable, inline: true, simple: true)
|
@@ -0,0 +1,12 @@
|
|
1
|
+
= card('Deadlines') do
|
2
|
+
= effective_form_with(model: [:admin, cpd_audit], engine: true) do |f|
|
3
|
+
%p The audittee has the following deadlines:
|
4
|
+
|
5
|
+
%ul
|
6
|
+
%li To declare conflict of interest: #{f.object.deadline_to_conflict_of_interest}
|
7
|
+
%li To request exemption: #{f.object.deadline_to_exemption}
|
8
|
+
%li To request extension: #{f.object.deadline_to_extension}
|
9
|
+
|
10
|
+
= f.check_box :ignore_deadlines, label: 'Yes, ignore audittee deadlines and allow these actions to be performed'
|
11
|
+
|
12
|
+
= f.submit 'Save', center: true
|
@@ -1,22 +1,23 @@
|
|
1
1
|
= render('layout') do
|
2
|
-
- raise('expected a submitted cpd_audit') unless resource.was_submitted?
|
2
|
+
- raise('expected a submitted cpd_audit') unless resource.was_submitted? || resource.closed?
|
3
3
|
|
4
|
-
.
|
5
|
-
.
|
6
|
-
.
|
7
|
-
|
8
|
-
.
|
4
|
+
- if resource.was_submitted?
|
5
|
+
.text-center
|
6
|
+
.row
|
7
|
+
.col-2
|
8
|
+
.col-8
|
9
|
+
.alert.alert-success Audit Submitted!
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
%p
|
12
|
+
The following audit was successfully submitted at
|
13
|
+
= succeed('.') do
|
14
|
+
= resource.submitted_at.strftime('%F')
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
- unless resource.determination.present?
|
17
|
+
Your audit must be reviewed and a final determination made.
|
18
|
+
We will send
|
19
|
+
%strong= resource.user.email
|
20
|
+
an email notifying you of the determination.
|
20
21
|
|
21
22
|
.mb-4= render(resource)
|
22
23
|
|
@@ -5,7 +5,7 @@
|
|
5
5
|
- resource.cpd_audit_reviews.each do |cpd_audit_review|
|
6
6
|
%li #{cpd_audit_review.user} <#{mail_to(cpd_audit_review.user.email)}>
|
7
7
|
|
8
|
-
- if resource.deadline_to_conflict_of_interest.present?
|
8
|
+
- if resource.deadline_to_conflict_of_interest.present? && !resource.ignore_deadlines?
|
9
9
|
%p The deadline to declare a conflict of interest is: #{resource.deadline_to_conflict_of_interest.strftime('%F')}.
|
10
10
|
|
11
11
|
= effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
- if resource.was_exemption_requested?
|
3
3
|
= render('effective/cpd_audits/exemption', cpd_audit: resource, step: :exemption)
|
4
4
|
|
5
|
-
- if resource.deadline_to_exemption.present?
|
5
|
+
- if resource.deadline_to_exemption.present? && !resource.ignore_deadlines?
|
6
6
|
%p The deadline to request an exemption is: #{resource.deadline_to_exemption.strftime('%F')}.
|
7
7
|
|
8
8
|
= effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
- if resource.was_extension_requested?
|
3
3
|
= render('effective/cpd_audits/extension', cpd_audit: resource, step: :extension)
|
4
4
|
|
5
|
-
- if resource.deadline_to_extension.present?
|
5
|
+
- if resource.deadline_to_extension.present? && !resource.ignore_deadlines?
|
6
6
|
%p The deadline to request an extension is: #{resource.deadline_to_extension.strftime('%F')}.
|
7
7
|
|
8
8
|
= effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
|
data/config/effective_cpd.rb
CHANGED
@@ -42,27 +42,21 @@ EffectiveCpd.setup do |config|
|
|
42
42
|
# Audit Reviewer Scope Collection
|
43
43
|
config.audit_reviewer_user_scope = :all
|
44
44
|
|
45
|
-
# Mailer
|
45
|
+
# Mailer Settings
|
46
|
+
# Please see config/initializers/effective_resources.rb for default effective_* gem mailer settings
|
47
|
+
#
|
46
48
|
# Configure the class responsible to send e-mails.
|
47
|
-
# config.mailer = 'Effective::
|
48
|
-
|
49
|
-
#
|
50
|
-
#
|
51
|
-
|
52
|
-
#
|
53
|
-
# config.
|
54
|
-
|
55
|
-
# Default
|
56
|
-
config.
|
57
|
-
|
58
|
-
#
|
59
|
-
config.
|
60
|
-
|
61
|
-
# Send Admin correspondence To
|
62
|
-
config.mailer_admin = "admin@example.com"
|
63
|
-
|
64
|
-
# Will work with effective_email_templates gem:
|
65
|
-
# - The audit and audit review email content will be preopulated based off the template
|
66
|
-
# - Uses an EmailTemplatesMailer mailer instead of ActionMailer::Base for default parent_mailer
|
67
|
-
config.use_effective_email_templates = false
|
49
|
+
# config.mailer = 'Effective::EventsMailer'
|
50
|
+
#
|
51
|
+
# Override effective_resource mailer defaults
|
52
|
+
#
|
53
|
+
# config.parent_mailer = nil # The parent class responsible for sending emails
|
54
|
+
# config.deliver_method = nil # The deliver method, deliver_later or deliver_now
|
55
|
+
# config.mailer_layout = nil # Default mailer layout
|
56
|
+
# config.mailer_sender = nil # Default From value
|
57
|
+
# config.mailer_admin = nil # Default To value for Admin correspondence
|
58
|
+
# config.mailer_subject = nil # Proc.new method used to customize Subject
|
59
|
+
|
60
|
+
# Use effective email templates for event notifications
|
61
|
+
config.use_effective_email_templates = true
|
68
62
|
end
|
data/lib/effective_cpd.rb
CHANGED
@@ -15,43 +15,14 @@ module EffectiveCpd
|
|
15
15
|
:cpd_audits_table_name, :cpd_audit_responses_table_name, :cpd_audit_response_options_table_name,
|
16
16
|
:cpd_audit_reviews_table_name, :cpd_audit_review_items_table_name,
|
17
17
|
:cycle_label, :credit_label, :layout, :auditee_user_scope, :audit_reviewer_user_scope,
|
18
|
-
:mailer, :parent_mailer, :deliver_method, :mailer_layout, :mailer_sender, :mailer_admin, :use_effective_email_templates
|
18
|
+
:mailer, :parent_mailer, :deliver_method, :mailer_layout, :mailer_sender, :mailer_admin, :mailer_subject, :use_effective_email_templates
|
19
19
|
]
|
20
20
|
end
|
21
21
|
|
22
22
|
include EffectiveGem
|
23
23
|
|
24
24
|
def self.mailer_class
|
25
|
-
|
26
|
-
Effective::CpdMailer
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.parent_mailer_class
|
30
|
-
return parent_mailer.constantize if parent_mailer.present?
|
31
|
-
|
32
|
-
if use_effective_email_templates
|
33
|
-
require 'effective_email_templates'
|
34
|
-
Effective::EmailTemplatesMailer
|
35
|
-
else
|
36
|
-
ActionMailer::Base
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def self.send_email(email, *args)
|
41
|
-
raise('expected args to be an Array') unless args.kind_of?(Array)
|
42
|
-
|
43
|
-
if defined?(Tenant)
|
44
|
-
tenant = Tenant.current || raise('expected a current tenant')
|
45
|
-
args << { tenant: tenant }
|
46
|
-
end
|
47
|
-
|
48
|
-
deliver_method = EffectiveCpd.deliver_method || EffectiveResources.deliver_method
|
49
|
-
|
50
|
-
begin
|
51
|
-
EffectiveCpd.mailer_class.send(email, *args).send(deliver_method)
|
52
|
-
rescue => e
|
53
|
-
raise if Rails.env.development? || Rails.env.test?
|
54
|
-
end
|
25
|
+
mailer&.constantize || Effective::CpdMailer
|
55
26
|
end
|
56
27
|
|
57
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_cpd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2
|
4
|
+
version: 0.3.2
|
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-
|
11
|
+
date: 2022-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -246,6 +246,7 @@ files:
|
|
246
246
|
- app/views/admin/cpd_audits/_auditee_fields.html.haml
|
247
247
|
- app/views/admin/cpd_audits/_form.html.haml
|
248
248
|
- app/views/admin/cpd_audits/_form_conflict.html.haml
|
249
|
+
- app/views/admin/cpd_audits/_form_deadlines.html.haml
|
249
250
|
- app/views/admin/cpd_audits/_form_determination.html.haml
|
250
251
|
- app/views/admin/cpd_audits/_form_exemption.html.haml
|
251
252
|
- app/views/admin/cpd_audits/_form_extension.html.haml
|
@@ -364,7 +365,6 @@ files:
|
|
364
365
|
- app/views/effective/cpd_statements/complete.html.haml
|
365
366
|
- app/views/effective/cpd_statements/start.html.haml
|
366
367
|
- app/views/effective/cpd_statements/submit.html.haml
|
367
|
-
- app/views/layouts/effective_cpd_mailer_layout.html.haml
|
368
368
|
- config/effective_cpd.rb
|
369
369
|
- config/routes.rb
|
370
370
|
- db/migrate/01_create_effective_cpd.rb.erb
|