diff --git a/app/lib/form_builders/tailwind.rb b/app/lib/form_builders/tailwind.rb index 82f28931a..6e53650e8 100644 --- a/app/lib/form_builders/tailwind.rb +++ b/app/lib/form_builders/tailwind.rb @@ -50,9 +50,13 @@ def error(method, options = {}) template.content_tag(:p, m, options.merge(class: "text-2xl text-error-red #{options[:class]}")) end - sig { params(text: String, options: T::Hash[Symbol, String]).returns(String) } - def hint(text, options = {}) - template.content_tag(:p, text, options.merge(class: "text-base italic text-warm-grey #{options[:class]}")) + sig { params(text_or_options: T.untyped, options: T::Hash[Symbol, String], block: T.untyped).returns(String) } + def hint(text_or_options = nil, options = {}, &block) + if block_given? + template.content_tag(:p, (text_or_options || {}).merge(class: "text-base italic text-warm-grey #{options[:class]}"), &block) + else + template.content_tag(:p, text_or_options, options.merge(class: "text-base italic text-warm-grey #{options[:class]}")) + end end sig { params(method: Symbol, options: T::Hash[Symbol, String]).returns(String) } diff --git a/app/views/_tailwind/contact_messages/_form.html.erb b/app/views/_tailwind/contact_messages/_form.html.erb index 065c72448..5a61ecb28 100644 --- a/app/views/_tailwind/contact_messages/_form.html.erb +++ b/app/views/_tailwind/contact_messages/_form.html.erb @@ -5,7 +5,9 @@ <%= f.label :name, "Your name", class: "block mb-3" %> <%= f.text_field :name, class: "block w-full" %> <%= f.error :name, class: "mt-2" %> - <%= f.hint "Or #{pa_link_to 'sign in', new_user_session_path}".html_safe %> + <%= f.hint do %> + Or <%= pa_link_to "sign in", new_user_session_path %> + <% end %>
<%= f.label :email, "Your email", class: "block mb-3" %> @@ -40,8 +42,9 @@ <%= recaptcha_tags %> <%# TODO: Make sure recaptcha errors are shown here %> <%= f.error :base, class: "mt-2" %> - <%# TODO: Add link to hint %> - <%= f.hint "Or sign in to remove this annoying reCaptcha", class: "mt-2" %> + <%= f.hint class: "mt-2" do %> + Or <%= pa_link_to "sign in", new_user_session_path %> to remove this annoying reCaptcha + <% end %>
<%= f.button "Send message to the Planning Alerts team" %>