|
| 1 | +<% content_for :head do %> |
| 2 | + <meta name="robots" content="noindex"> |
| 3 | +<% end %> |
| 4 | + |
| 5 | +<% |
| 6 | + ga4_english_strings = { |
| 7 | + page_title: t("controllers.contact.govuk_app.chat_feedback.new.title", locale: :en), |
| 8 | + questions: { |
| 9 | + feedback: t("controllers.contact.govuk_app.chat_feedback.new.feedback", locale: :en), |
| 10 | + reply: t("controllers.contact.govuk_app.shared.can_we_reply", locale: :en), |
| 11 | + email: t("controllers.contact.govuk_app.shared.email", locale: :en), |
| 12 | + name: t("controllers.contact.govuk_app.shared.name", locale: :en), |
| 13 | + }, |
| 14 | + send_message: t("controllers.contact.govuk_app.chat_feedback.new.send_feedback", locale: :en) |
| 15 | + } |
| 16 | + |
| 17 | + ga4_form_tracker_json = { |
| 18 | + event_name: "form_response", |
| 19 | + type: "contact", |
| 20 | + section: ga4_english_strings[:questions].values.join(", "), |
| 21 | + action: ga4_english_strings[:send_message], |
| 22 | + tool_name: ga4_english_strings[:page_title] |
| 23 | + }.to_json |
| 24 | +%> |
| 25 | + |
| 26 | +<% if @errors |
| 27 | + ga4_erroring_sections = @errors.keys.map do |error_key| |
| 28 | + ga4_english_strings[:questions][error_key] |
| 29 | + end |
| 30 | + |
| 31 | + ga4_auto_tracker_json = { |
| 32 | + event_name: 'form_error', |
| 33 | + type: 'contact', |
| 34 | + action: 'error', |
| 35 | + text: @errors.values.map { |field_errors| field_errors.join(', ') }.join(', '), |
| 36 | + section: ga4_erroring_sections.join(', '), |
| 37 | + tool_name: ga4_english_strings[:page_title] |
| 38 | + }.to_json |
| 39 | + |
| 40 | + content_for :error_summary do |
| 41 | + render partial: "shared/error_summary", locals: { ga4_auto_tracker_json: ga4_auto_tracker_json } |
| 42 | + end |
| 43 | +end %> |
| 44 | + |
| 45 | +<% content_for :title do t("controllers.contact.govuk_app.chat_feedback.new.title") end %> |
| 46 | + |
| 47 | +<%= form_tag contact_govuk_app_chat_feedback_path, method: :post, class: "contact-form", data: { module: "ga4-form-tracker", ga4_form: ga4_form_tracker_json } do |f| %> |
| 48 | + <%= render partial: "shared/spam_honeypot", locals: { form_name: "chat_feedback" } %> |
| 49 | + |
| 50 | + <%= render "govuk_publishing_components/components/character_count", { |
| 51 | + textarea: { |
| 52 | + value: @ticket ? @ticket.feedback : nil, |
| 53 | + error_message: @errors ? @errors[:feedback].first : nil, |
| 54 | + label: { |
| 55 | + text: t("controllers.contact.govuk_app.chat_feedback.new.feedback"), |
| 56 | + heading_size: "m" |
| 57 | + }, |
| 58 | + name: "chat_feedback[feedback]" |
| 59 | + }, |
| 60 | + id: "feedback", |
| 61 | + maxlength: 1200 |
| 62 | + } %> |
| 63 | + |
| 64 | + <% reply_inputs = capture do %> |
| 65 | + <%= render "govuk_publishing_components/components/input", { |
| 66 | + label: { |
| 67 | + text: t("controllers.contact.govuk_app.shared.email"), |
| 68 | + heading_size: "s" |
| 69 | + }, |
| 70 | + name: "chat_feedback[email]", |
| 71 | + id: "email", |
| 72 | + value: @ticket ? @ticket.email : nil, |
| 73 | + error_message: @errors ? @errors[:email].first : nil, |
| 74 | + width: 20, |
| 75 | + hint: "We will only use this to reply to your message" |
| 76 | + } %> |
| 77 | + |
| 78 | + <%= render "govuk_publishing_components/components/input", { |
| 79 | + label: { |
| 80 | + text: t("controllers.contact.govuk_app.shared.name"), |
| 81 | + heading_size: "s" |
| 82 | + }, |
| 83 | + name: "chat_feedback[name]", |
| 84 | + id: "name", |
| 85 | + value: @ticket ? @ticket.name : nil, |
| 86 | + width: 20 |
| 87 | + } %> |
| 88 | + |
| 89 | + <br /> |
| 90 | + <%= t("controllers.contact.govuk_app.shared.personal_information_html") %> |
| 91 | + <% end %> |
| 92 | + |
| 93 | + <%= render "govuk_publishing_components/components/radio", { |
| 94 | + name: "chat_feedback[reply]", |
| 95 | + error_message: @errors ? @errors[:reply].first : nil, |
| 96 | + heading: t("controllers.contact.govuk_app.shared.can_we_reply"), |
| 97 | + heading_size: "m", |
| 98 | + heading_level: 0, |
| 99 | + id: "reply", |
| 100 | + items: [ |
| 101 | + { |
| 102 | + value: "yes", |
| 103 | + text: t("controllers.contact.govuk_app.shared.yes"), |
| 104 | + conditional: reply_inputs, |
| 105 | + checked: @ticket ? @ticket.reply == "yes" : false, |
| 106 | + }, |
| 107 | + { |
| 108 | + value: "no", |
| 109 | + text: t("controllers.contact.govuk_app.shared.no"), |
| 110 | + checked: @ticket ? @ticket.reply == "no" : false, |
| 111 | + } |
| 112 | + ] |
| 113 | + } %> |
| 114 | + |
| 115 | + <p class="govuk-body"> |
| 116 | + Find out how we use your personal information in the <a class="govuk-link" href="/government/publications/govuk-chat-privacy-notice">privacy notice</a>. |
| 117 | + </p> |
| 118 | + |
| 119 | + <%= render "govuk_publishing_components/components/button", { |
| 120 | + text: t("controllers.contact.govuk_app.chat_feedback.new.send_feedback"), |
| 121 | + margin_bottom: true |
| 122 | + } %> |
| 123 | +<% end %> |
0 commit comments