gov_fake_notify 1.1.1 → 1.1.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/Gemfile.lock +1 -1
- data/lib/gov_fake_notify/commands/send_email_command.rb +69 -19
- data/lib/gov_fake_notify/version.rb +1 -1
- data/lib/views/govuk/file.text.erb +1 -0
- data/lib/views/govuk/horizontal_line.text.erb +1 -0
- data/lib/views/govuk/paragraph.text.erb +1 -0
- data/lib/views/layouts/govuk.text.erb +2 -0
- metadata +6 -3
- data/lib/views/govuk/show.html.erb +0 -19
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2e714d999dc608449e951c182d38492a7d59caca2fa34a2012fbe7b95796c526
|
|
4
|
+
data.tar.gz: 216d296b4e3954ed95e8abf03d81c1b72b205c32ac8a22fde5baefc5be62ba4c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 36f60d04dbc6be94cc0087fe03ede387688c63c68f40a180c3d55f89f0048d2c135e17663b0e7f8080832725007416fe772db31e9331a3305eac3b61dc8a749c
|
|
7
|
+
data.tar.gz: f8df368185901d57df36497af67d28c4e0282fc0cc897ec3cd99cfb09bea853b9b0a6fb3d3146ed16a7c7cb9c4e731a2b84bb3a2f73d277281da0de75e03ee8e
|
data/Gemfile.lock
CHANGED
|
@@ -57,19 +57,20 @@ module GovFakeNotify
|
|
|
57
57
|
def send_email_from_template(template_data) # rubocop:disable Metrics/MethodLength
|
|
58
58
|
pre_process_files
|
|
59
59
|
our_params = params
|
|
60
|
-
|
|
60
|
+
our_html_body = mail_message_html(template_data)
|
|
61
|
+
our_text_body = mail_message_text(template_data)
|
|
61
62
|
our_service = service
|
|
62
|
-
@message_body =
|
|
63
|
+
@message_body = our_html_body
|
|
63
64
|
mail = Mail.new do
|
|
64
65
|
from our_service['service_email']
|
|
65
66
|
to our_params['email_address']
|
|
66
67
|
subject template_data['subject']
|
|
67
68
|
html_part do
|
|
68
69
|
content_type 'text/html; charset=UTF-8'
|
|
69
|
-
body
|
|
70
|
+
body our_html_body
|
|
70
71
|
end
|
|
71
72
|
text_part do
|
|
72
|
-
body
|
|
73
|
+
body our_text_body
|
|
73
74
|
end
|
|
74
75
|
end
|
|
75
76
|
mail.deliver
|
|
@@ -101,53 +102,102 @@ module GovFakeNotify
|
|
|
101
102
|
end
|
|
102
103
|
end
|
|
103
104
|
|
|
104
|
-
def
|
|
105
|
+
def mail_message_html(template_data)
|
|
105
106
|
layout = Tilt.new(File.absolute_path('../../views/layouts/govuk.html.erb', __dir__))
|
|
106
107
|
layout.render do
|
|
107
|
-
|
|
108
|
+
template_content_html(template_data)
|
|
108
109
|
end
|
|
109
110
|
end
|
|
110
111
|
|
|
111
|
-
def
|
|
112
|
+
def mail_message_text(template_data)
|
|
113
|
+
layout = Tilt.new(File.absolute_path('../../views/layouts/govuk.text.erb', __dir__))
|
|
114
|
+
layout.render do
|
|
115
|
+
template_content_text(template_data)
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def template_content_html(template_data)
|
|
112
120
|
template = template_data['message']
|
|
113
121
|
buffer = ''.dup
|
|
114
122
|
template.each_line do |line|
|
|
115
|
-
buffer <<
|
|
123
|
+
buffer << format_line_html(line)
|
|
116
124
|
end
|
|
117
125
|
buffer
|
|
118
126
|
end
|
|
119
127
|
|
|
120
|
-
def
|
|
128
|
+
def template_content_text(template_data)
|
|
129
|
+
template = template_data['message']
|
|
130
|
+
buffer = ''.dup
|
|
131
|
+
template.each_line do |line|
|
|
132
|
+
buffer << format_line_text(line)
|
|
133
|
+
end
|
|
134
|
+
buffer
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def format_line_html(line)
|
|
138
|
+
replaced = line.gsub(/\(\(([^)]*)\)\)/) do
|
|
139
|
+
post_process_value_html params['personalisation'][Regexp.last_match[1]]
|
|
140
|
+
end
|
|
141
|
+
wrap_line_html(replaced)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def format_line_text(line)
|
|
121
145
|
replaced = line.gsub(/\(\(([^)]*)\)\)/) do
|
|
122
|
-
|
|
146
|
+
post_process_value_text params['personalisation'][Regexp.last_match[1]]
|
|
123
147
|
end
|
|
124
|
-
|
|
148
|
+
wrap_line_text(replaced)
|
|
125
149
|
end
|
|
126
150
|
|
|
127
|
-
def
|
|
151
|
+
def post_process_value_html(value)
|
|
128
152
|
return value unless value.is_a?(Hash) && value.keys.include?('file')
|
|
129
153
|
|
|
130
|
-
|
|
154
|
+
render_file_html(value)
|
|
131
155
|
end
|
|
132
156
|
|
|
133
|
-
def
|
|
157
|
+
def post_process_value_text(value)
|
|
158
|
+
return value unless value.is_a?(Hash) && value.keys.include?('file')
|
|
159
|
+
|
|
160
|
+
render_file_text(value)
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def wrap_line_html(line)
|
|
164
|
+
case line
|
|
165
|
+
when /^---/ then render_horizontal_line_html
|
|
166
|
+
else render_paragraph_html(line)
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
def wrap_line_text(line)
|
|
134
171
|
case line
|
|
135
|
-
when /^---/ then
|
|
136
|
-
else
|
|
172
|
+
when /^---/ then render_horizontal_line_text
|
|
173
|
+
else render_paragraph_text(line)
|
|
137
174
|
end
|
|
138
175
|
end
|
|
139
176
|
|
|
140
|
-
def
|
|
177
|
+
def render_horizontal_line_html
|
|
141
178
|
Tilt.new(File.absolute_path('../../views/govuk/horizontal_line.html.erb', __dir__)).render
|
|
142
179
|
end
|
|
143
180
|
|
|
144
|
-
def
|
|
181
|
+
def render_horizontal_line_text
|
|
182
|
+
Tilt.new(File.absolute_path('../../views/govuk/horizontal_line.text.erb', __dir__)).render
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
def render_paragraph_html(line)
|
|
145
186
|
Tilt.new(File.absolute_path('../../views/govuk/paragraph.html.erb', __dir__)).render(nil, content: line)
|
|
146
187
|
end
|
|
147
188
|
|
|
148
|
-
def
|
|
189
|
+
def render_paragraph_text(line)
|
|
190
|
+
Tilt.new(File.absolute_path('../../views/govuk/paragraph.text.erb', __dir__)).render(nil, content: line)
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
def render_file_html(file_data)
|
|
149
194
|
Tilt.new(File.absolute_path('../../views/govuk/file.html.erb', __dir__)).render(nil, file_data: file_data,
|
|
150
195
|
base_url: base_url)
|
|
151
196
|
end
|
|
197
|
+
|
|
198
|
+
def render_file_text(file_data)
|
|
199
|
+
Tilt.new(File.absolute_path('../../views/govuk/file.text.erb', __dir__)).render(nil, file_data: file_data,
|
|
200
|
+
base_url: base_url)
|
|
201
|
+
end
|
|
152
202
|
end
|
|
153
203
|
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= base_url %>/files/confirm/<%= File.basename file_data['file'] %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
-------------------------------------------
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= content %>
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gov_fake_notify
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- garytaylor
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-10-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activemodel
|
|
@@ -186,10 +186,13 @@ files:
|
|
|
186
186
|
- lib/views/files/confirm.html.erb
|
|
187
187
|
- lib/views/files/download.html.erb
|
|
188
188
|
- lib/views/govuk/file.html.erb
|
|
189
|
+
- lib/views/govuk/file.text.erb
|
|
189
190
|
- lib/views/govuk/horizontal_line.html.erb
|
|
191
|
+
- lib/views/govuk/horizontal_line.text.erb
|
|
190
192
|
- lib/views/govuk/paragraph.html.erb
|
|
191
|
-
- lib/views/govuk/
|
|
193
|
+
- lib/views/govuk/paragraph.text.erb
|
|
192
194
|
- lib/views/layouts/govuk.html.erb
|
|
195
|
+
- lib/views/layouts/govuk.text.erb
|
|
193
196
|
homepage: https://github.com/hmcts/gov_fake_notify
|
|
194
197
|
licenses:
|
|
195
198
|
- MIT
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<p style="Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c">Claim number: 262000200400</p>
|
|
2
|
-
<p style="Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c">Gary Taylor</p>
|
|
3
|
-
<p style="Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c">Thank you for submitting your claim to an employment tribunal.</p>
|
|
4
|
-
<hr style="border:0;height:1px;background:#bfc1c3;Margin:30px 0 30px 0">
|
|
5
|
-
<p style="Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c">WHAT HAPPENS NEXT</p>
|
|
6
|
-
<p style="Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c">We’ll contact you once we have sent your claim to the respondent and explain what happens next.<br>At present, this is taking us an average of 25 days.<br>Once we have sent them your claim, the respondent has 28 days to reply.</p>
|
|
7
|
-
<hr style="border:0;height:1px;background:#bfc1c3;Margin:30px 0 30px 0">
|
|
8
|
-
<p style="Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c">SUBMISSION DETAILS</p>
|
|
9
|
-
<p style="Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c">Claim submitted: 09 October 2020<br>Tribunal office: Midlands (East) ET<br>Contact: <a href="mailto:midlandseastet@justice.gov.uk" target="_blank">midlandseastet@justice.gov.uk</a>, 0115 947 5701</p>
|
|
10
|
-
<hr style="border:0;height:1px;background:#bfc1c3;Margin:30px 0 30px 0">
|
|
11
|
-
<p style="Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c">Please use the link below to download a copy of your claim.<br><a style="word-wrap:break-word;color:#005ea5" href="https://documents.service.gov.uk/d/f8FKyAk4SCeu4_sjf5zV5w/p0-ZUPWESuGUsbUdomOoHQ?key=VvieEVMIEWUZTKZQWPR4Lb4HWCeCwVi3WtaqJICgvfA" target="_blank" data-saferedirecturl="https://www.google.com/url?q=https://documents.service.gov.uk/d/f8FKyAk4SCeu4_sjf5zV5w/p0-ZUPWESuGUsbUdomOoHQ?key%3DVvieEVMIEWUZTKZQWPR4Lb4HWCeCwVi3WtaqJICgvfA&source=gmail&ust=1632034513216000&usg=AFQjCNG4im8mu2Nu231SXyHMi3gptqaYaQ">https://documents.service.gov.<wbr>uk/d/f8FKyAk4SCeu4_sjf5zV5w/<wbr>p0-ZUPWESuGUsbUdomOoHQ?key=<wbr>VvieEVMIEWUZTKZQWPR4Lb4HWCeCwV<wbr>i3WtaqJICgvfA</a></p>
|
|
12
|
-
<hr style="border:0;height:1px;background:#bfc1c3;Margin:30px 0 30px 0">
|
|
13
|
-
<p style="Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c">Additional Information File</p>
|
|
14
|
-
<p style="Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c">no additional file</p>
|
|
15
|
-
<p style="Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c">no additional file</p>
|
|
16
|
-
<hr style="border:0;height:1px;background:#bfc1c3;Margin:30px 0 30px 0">
|
|
17
|
-
<p style="Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c">Your feedback helps us improve this service:<br><a style="word-wrap:break-word;color:#005ea5" href="https://www.gov.uk/done/employment-tribunals-make-a-claim" target="_blank" data-saferedirecturl="https://www.google.com/url?q=https://www.gov.uk/done/employment-tribunals-make-a-claim&source=gmail&ust=1632034513216000&usg=AFQjCNHY6ZdK3Y4wrMzZ6kpEubbSkN6byQ">https://www.gov.uk/done/<wbr>employment-tribunals-make-a-<wbr>claim</a></p>
|
|
18
|
-
<p style="Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c">Help us keep track. Complete our diversity monitoring questionnaire.<br><a style="word-wrap:break-word;color:#005ea5" href="https://employmenttribunals.service.gov.uk/en/apply/diversity" target="_blank" data-saferedirecturl="https://www.google.com/url?q=https://employmenttribunals.service.gov.uk/en/apply/diversity&source=gmail&ust=1632034513216000&usg=AFQjCNGBtP5C9AjOY9cl0HAKTJYjMna5BA">https://employmenttribunals.<wbr>service.gov.uk/en/apply/<wbr>diversity</a></p>
|
|
19
|
-
<p style="Margin:0 0 20px 0;font-size:19px;line-height:25px;color:#0b0c0c">Contact us: <a style="word-wrap:break-word;color:#005ea5" href="http://www.justice.gov.uk/contacts/hmcts/tribunals/employment" target="_blank" data-saferedirecturl="https://www.google.com/url?q=http://www.justice.gov.uk/contacts/hmcts/tribunals/employment&source=gmail&ust=1632034513216000&usg=AFQjCNEq9IFj6UCn4aCCO1P8taYI_SQQRw">http://www.justice.gov.uk/<wbr>contacts/hmcts/tribunals/<wbr>employment</a></p>
|