updated check availability message in api and in form; modified js to display html rather than text

This commit is contained in:
David Kennedy 2023-11-25 06:06:37 -05:00
parent ebafb31f70
commit 7bac5185b0
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B
2 changed files with 9 additions and 3 deletions

View file

@ -2,6 +2,9 @@
from django.apps import apps from django.apps import apps
from django.views.decorators.http import require_http_methods from django.views.decorators.http import require_http_methods
from django.http import JsonResponse from django.http import JsonResponse
from django.utils.safestring import mark_safe
from registrar.templatetags.url_helpers import public_site_url
import requests import requests
@ -18,8 +21,11 @@ DOMAIN_API_MESSAGES = {
" For example, if you want www.city.gov, you would enter “city”" " For example, if you want www.city.gov, you would enter “city”"
" (without the quotes).", " (without the quotes).",
"extra_dots": "Enter the .gov domain you want without any periods.", "extra_dots": "Enter the .gov domain you want without any periods.",
"unavailable": "That domain isnt available. Try entering another one." "unavailable": mark_safe( # nosec
" Contact us if you need help coming up with a domain.", "That domain isnt available. "
"<a class='usa-link' href='{}' target='_blank'>"
"Read more about choosing your .gov domain.</a>".format(public_site_url("domains/choosing"))
),
"invalid": "Enter a domain using only letters, numbers, or hyphens (though we don't recommend using hyphens).", "invalid": "Enter a domain using only letters, numbers, or hyphens (though we don't recommend using hyphens).",
"success": "That domain is available!", "success": "That domain is available!",
"error": "Error finding domain availability.", "error": "Error finding domain availability.",

View file

@ -115,7 +115,7 @@ function inlineToast(el, id, style, msg) {
toast.className = `usa-alert usa-alert--${style} usa-alert--slim`; toast.className = `usa-alert usa-alert--${style} usa-alert--slim`;
toastBody.classList.add("usa-alert__body"); toastBody.classList.add("usa-alert__body");
p.classList.add("usa-alert__text"); p.classList.add("usa-alert__text");
p.innerText = msg; p.innerHTML = msg;
toastBody.appendChild(p); toastBody.appendChild(p);
toast.appendChild(toastBody); toast.appendChild(toastBody);
el.parentNode.insertBefore(toast, el.nextSibling); el.parentNode.insertBefore(toast, el.nextSibling);