-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy path_made_live_form.html.erb
More file actions
271 lines (244 loc) · 12.8 KB
/
_made_live_form.html.erb
File metadata and controls
271 lines (244 loc) · 12.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
<% set_page_title(form_document.name) %>
<% if form_metadata.group.present? %>
<% content_for :back_link, govuk_back_link_to(group_path(form_metadata.group), t("back_link.group", group_name: form_metadata.group.name)) %>
<% else %>
<% content_for :back_link, govuk_back_link_to(root_path, t("back_link.forms")) %>
<% end %>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-xl govuk-!-margin-bottom-2">
<%= form_document.name %>
</h1>
<%= render FormStatusTagDescriptionComponent::View.new(status: status) %>
<% metrics_data = CloudWatchService.new(form_document.id).past_week_metrics_data %>
<%= render MetricsSummaryComponent::View.new(form_id: form_document.id, form_live_date: form_document.made_live_date, metrics_data:) %>
</div>
</div>
<div class="govuk-grid-row">
<%= tag.div(class: form_document.has_welsh_translation? ? "govuk-grid-column-full" : "govuk-grid-column-two-thirds") do %>
<h2 class="govuk-heading-l"><%= t(".title") %></h2>
<% if form_document.has_welsh_translation? %>
<ul class="govuk-list">
<li><%= render PreviewLinkComponent::View.new(form_document.steps, link_to_runner(Settings.forms_runner.url, form_document.id, form_document.form_slug, mode: preview_mode), t(".preview.en")) %></li>
<li><%= render PreviewLinkComponent::View.new(form_document.steps, link_to_runner(Settings.forms_runner.url, form_document.id, form_document.form_slug, mode: preview_mode, locale: "cy"), t(".preview.cy")) %></li>
</ul>
<% else %>
<p>
<%= render PreviewLinkComponent::View.new(form_document.steps, link_to_runner(Settings.forms_runner.url, form_document.id, form_document.form_slug, mode: preview_mode)) %>
</p>
<% end %>
<% if form_document.has_welsh_translation? %>
<h3 class="govuk-heading-m"><%= t(".welsh_form_name") %></h3>
<p><%= welsh_form_document.name %></p>
<% end %>
<% if status == :live %>
<% if form_document.has_welsh_translation? %>
<%= render FormUrlComponent::View.new(runner_link: link_to_runner(Settings.forms_runner.url, form_document.id, form_document.form_slug, mode: :live), heading_text: t(".live_form_url_multilingual.en"), heading_level: 3 )%>
<%= render FormUrlComponent::View.new(runner_link: link_to_runner(Settings.forms_runner.url, form_document.id, form_document.form_slug, mode: :live, locale: "cy"), heading_text: t(".live_form_url_multilingual.cy"), heading_level: 3) %>
<% else %>
<%= render FormUrlComponent::View.new(runner_link: link_to_runner(Settings.forms_runner.url, form_document.id, form_document.form_slug, mode: :live), heading_text: t(".live_form_url"), heading_level: 3) %>
<% end %>
<% else %>
<% if form_document.has_welsh_translation? %>
<%= render FormUrlComponent::View.new(runner_link: link_to_runner(Settings.forms_runner.url, form_document.id, form_document.form_slug, mode: :live), heading_text: t(".archived_form_url_multilingual.en"), heading_level: 3) %>
<%= render FormUrlComponent::View.new(runner_link: link_to_runner(Settings.forms_runner.url, form_document.id, form_document.form_slug, mode: :live, locale: "cy"), heading_text: t(".archived_form_url_multilingual.cy"), heading_level: 3) %>
<% else %>
<%= render FormUrlComponent::View.new(runner_link: link_to_runner(Settings.forms_runner.url, form_document.id, form_document.form_slug, mode: :live), heading_text: t(".archived_form_url"), heading_level: 3) %>
<% end %>
<% end %>
<h3 class="govuk-heading-m"><%= t('.questions') %></h3>
<p><%= govuk_link_to t('.questions_link', count: form_document.steps.count), questions_path %></p>
<% if form_document.declaration_markdown.present? %>
<% if form_document.has_welsh_translation? %>
<%= govuk_summary_card(title: t('.declaration')) do |card| %>
<%= govuk_table do |table| %>
<%= table.with_caption(size: 'm', text: t(".declaration"), classes:"govuk-visually-hidden")
table.with_head(**Forms::TranslationTablePresenter.new.two_column_headers) %>
<%= table.with_body do |body|
body.with_row do |row|
row.with_cell do
GovukFormsMarkdown.render(form_document.declaration_markdown, locale: "en").html_safe
end
row.with_cell do
GovukFormsMarkdown.render(welsh_form_document.declaration_markdown, locale: "cy").html_safe
end
end
end %>
<% end %>
<%= govuk_details(summary_text: t('.what_is_declaration'), text: t('.declaration_description')) %>
<% end %>
<% else %>
<h3 class="govuk-heading-m"><%= t('.declaration') %></h3>
<div class="app-preview-area">
<%= GovukFormsMarkdown.render(form_document.declaration_markdown, locale: "en").html_safe %>
</div>
<%= govuk_details(summary_text: t('.what_is_declaration'), text: t('.declaration_description')) %>
<% end %>
<% end %>
<% if form_document.has_welsh_translation? %>
<%= govuk_summary_card(title: t('.what_happens_next')) do |card| %>
<%= govuk_table do |table| %>
<%= table.with_caption(size: 'm', text: t(".what_happens_next"), classes:"govuk-visually-hidden")
table.with_head(**Forms::TranslationTablePresenter.new.two_column_headers) %>
<%= table.with_body do |body|
body.with_row do |row|
row.with_cell do
GovukFormsMarkdown.render(form_document.what_happens_next_markdown, locale: "en").html_safe
end
row.with_cell do
GovukFormsMarkdown.render(welsh_form_document.what_happens_next_markdown, locale: "cy").html_safe
end
end
end %>
<% end %>
<%= govuk_details(summary_text: t('.what_is_what_happens_next'), text: t('.what_happens_next_description')) %>
<% end %>
<% else %>
<h3 class="govuk-heading-m"><%= t('.what_happens_next') %></h3>
<div class="app-preview-area">
<%= GovukFormsMarkdown.render(form_document.what_happens_next_markdown, locale: "en").html_safe %>
</div>
<%= govuk_details(summary_text: t('.what_is_what_happens_next'), text: t('.what_happens_next_description')) %>
<% end %>
<% if form_document.respond_to?(:payment_url) && form_document.payment_url.present? %>
<% if form_document.has_welsh_translation? %>
<%= govuk_summary_card(title: t('.payment_link')) do |card| %>
<%= govuk_table do |table| %>
<%= table.with_caption(size: 'm', text: t(".payment_link"), classes:"govuk-visually-hidden")
table.with_head(**Forms::TranslationTablePresenter.new.two_column_headers) %>
<%= table.with_body do |body|
body.with_row do |row|
row.with_cell do
govuk_link_to(form_document.payment_url, form_document.payment_url)
end
row.with_cell do
govuk_link_to(welsh_form_document.payment_url, welsh_form_document.payment_url)
end
end
end %>
<% end %>
<% end %>
<% else %>
<h3 class="govuk-heading-m"><%= t(".payment_link") %></h3>
<p><%= govuk_link_to(form_document.payment_url, form_document.payment_url) %></p>
<% end %>
<% end %>
<h3 class="govuk-heading-m"><%= t(".how_you_get_completed_forms.title") %></h3>
<h4 class="govuk-heading-s"><%= t('.how_you_get_completed_forms.submission_email') %></h4>
<p class="govuk-!-text-break-word"><%= form_document.submission_email %></p>
<% if form_document.submission_type == "email" %>
<% submission_format = ["email", *form_document.submission_format].join("_") %>
<h4 class="govuk-heading-s"><%= t(".how_you_get_completed_forms.csv_and_json") %></h4>
<p><%= t(".how_you_get_completed_forms.submission_format.email.#{submission_format}_html") %></p>
<% end %>
<h4 class="govuk-heading-s"><%= t(".how_you_get_completed_forms.daily_csv.title") %></h4>
<% if form_document.send_daily_submission_batch %>
<p><%= t(".how_you_get_completed_forms.daily_csv.enabled") %></p>
<% else %>
<p><%= t(".how_you_get_completed_forms.daily_csv.disabled") %></p>
<% end %>
<% if form_document.has_welsh_translation? %>
<%= govuk_summary_card(title: t('.privacy_policy_link')) do |card| %>
<%= govuk_table do |table| %>
<%= table.with_caption(size: 'm', text: t(".privacy_policy_link"), classes:"govuk-visually-hidden")
table.with_head(**Forms::TranslationTablePresenter.new.two_column_headers) %>
<%= table.with_body do |body|
body.with_row do |row|
row.with_cell do
govuk_link_to(form_document.privacy_policy_url, form_document.privacy_policy_url)
end
row.with_cell do
govuk_link_to(welsh_form_document.privacy_policy_url, welsh_form_document.privacy_policy_url)
end
end
end %>
<% end %>
<% end %>
<% else %>
<h3 class="govuk-heading-m"><%= t('.privacy_policy_link') %></h3>
<p><%= govuk_link_to(form_document.privacy_policy_url, form_document.privacy_policy_url) %></p>
<% end %>
<% if form_document.has_welsh_translation? %>
<%= govuk_summary_card(title: t('.contact_details')) do |card| %>
<%= govuk_table do |table| %>
<%= table.with_caption(size: 'm', text: t(".contact_details"), classes:"govuk-visually-hidden")
table.with_head(**Forms::TranslationTablePresenter.new.three_column_headers) %>
<%= table.with_body do |body|
if form_document.support_email
body.with_row do |row|
row.with_cell(header: true) do
t('forms.made_live_form.support_email')
end
row.with_cell do
form_document.support_email
end
row.with_cell do
welsh_form_document.support_email
end
end
end
if form_document.support_phone
body.with_row do |row|
row.with_cell(header: true) do
t('forms.made_live_form.support_phone')
end
row.with_cell do
form_document.support_phone
end
row.with_cell do
welsh_form_document.support_phone
end
end
end
if form_document.support_url
body.with_row do |row|
row.with_cell(header: true) do
t('forms.made_live_form.support_url')
end
row.with_cell do
govuk_link_to form_document.support_url_text, form_document.support_url
end
row.with_cell do
govuk_link_to welsh_form_document.support_url_text, welsh_form_document.support_url
end
end
end
end %>
<% end %>
<% end %>
<% else %>
<h3 class="govuk-heading-m"><%= t('.contact_details') %></h3>
<% if form_document.support_email %>
<h4 class="govuk-heading-s"><%= t('.support_email') %></h4>
<p class="govuk-!-text-break-word"><%= form_document.support_email %></p>
<% end %>
<% if form_document.support_phone %>
<h4 class="govuk-heading-s"><%= t('.support_phone') %></h4>
<p><%= form_document.support_phone %></p>
<% end %>
<% if form_document.support_url %>
<h4 class="govuk-heading-s"><%= t('.support_url') %></h4>
<p><%= govuk_link_to form_document.support_url_text, form_document.support_url %></p>
<% end %>
<% end %>
<% end %>
</div>
<div class="govuk-grid-row">
<div class="govuk-grid-column-full">
<div class="govuk-button-group">
<%# i18n-tasks-use t('.draft_create') %>
<%# i18n-tasks-use t('.draft_edit') %>
<%= govuk_button_link_to t(".draft_#{ form_metadata.has_draft_version ? 'edit': 'create'}"), form_path(form_document.id) %>
<% if status == :live %>
<%= govuk_button_link_to t(".archive_this_form"), archive_form_path(form_document.id), warning: true %>
<%= govuk_button_link_to("Make a copy of this form", copy_form_path(form_metadata.id, "live"), secondary: true) %>
<% if form_metadata.live_welsh_form_document.present? %>
<%= govuk_button_link_to t(".archive_welsh"), archive_welsh_path(form_document.id), secondary: true %>
<% end %>
<% elsif status == :archived %>
<%= govuk_button_link_to t(".make_this_form_live"), unarchive_path(form_document.id), secondary: true %>
<%= govuk_button_link_to(t(".make_a_copy"), copy_form_path(form_metadata.id, "archived"), secondary: true) %>
<% end %>
</div>
</div>
</div>