From 73f99f72f779c6e81c9843395dff8f29ed27e1b8 Mon Sep 17 00:00:00 2001 From: Ryan Wold Date: Mon, 18 Dec 2023 12:23:56 -0800 Subject: [PATCH] add text to big thumbs buttons * show a preview of a Form's Success message --- .../admin/questions/_success_text.html.erb | 10 +++++++++- app/views/components/forms/_flash.html.erb | 4 ++-- .../components/forms/edit/_builder.html.erb | 18 ++++++++++++++++-- .../_big_thumbs_up_down_buttons.html.erb | 2 ++ app/views/components/widget/_widget.css.erb | 6 ++++++ 5 files changed, 35 insertions(+), 5 deletions(-) diff --git a/app/views/admin/questions/_success_text.html.erb b/app/views/admin/questions/_success_text.html.erb index e9492281d..73c1d47f8 100644 --- a/app/views/admin/questions/_success_text.html.erb +++ b/app/views/admin/questions/_success_text.html.erb @@ -1,6 +1,6 @@ <%= form_with(model: form, url: (form.persisted? ? admin_form_path(form) : admin_forms_path), local: true) do |f| %>
-
+
<%= f.label :success_text_heading, "SUCCESS TEXT HEADING", class: "usa-label text-uppercase font-body-3xs" %> <%= f.text_field :success_text_heading, class: "usa-input success_text", data_url: admin_form_path(form) %> @@ -38,5 +38,13 @@ $('.usa-hint.save-notice.survey-success-text').fadeOut(2000); }); }); + + $("#form_success_text_heading").on("keyup", function(event, b) { + $(".fba-alert.usa-alert--success h3.usa-alert__heading").text(event.target.value) + }); + + $("#form_success_text").on("keyup", function(event, b) { + $(".fba-alert.usa-alert--success .usa-alert__text").html(event.target.value) + }); }) diff --git a/app/views/components/forms/_flash.html.erb b/app/views/components/forms/_flash.html.erb index a8ed476ea..694bd5685 100644 --- a/app/views/components/forms/_flash.html.erb +++ b/app/views/components/forms/_flash.html.erb @@ -3,9 +3,9 @@

<%= form.success_text_heading %>

-

+

<%= sanitize(form.success_text) %> -

+

+
-
- <%= render "admin/questions/success_text", {form: form} %> + +
+
+
+ <%= render "admin/questions/success_text", {form: form} %> +
+
+
+
+
+ <%= render "components/forms/flash", form: form %> +
+