mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-14 15:05:14 +02:00
Use a demo site banner to avoid confusion
This commit is contained in:
parent
4722ec43e8
commit
2cc799bb65
3 changed files with 29 additions and 1 deletions
|
@ -146,7 +146,6 @@ STATICFILES_DIRS = [
|
|||
BASE_DIR / "assets",
|
||||
]
|
||||
|
||||
# TODO: decide on template engine and document in ADR
|
||||
TEMPLATES = [
|
||||
{
|
||||
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
||||
|
@ -168,11 +167,16 @@ TEMPLATES = [
|
|||
"django.contrib.messages.context_processors.messages",
|
||||
"registrar.context_processors.language_code",
|
||||
"registrar.context_processors.canonical_path",
|
||||
"registrar.context_processors.is_demo_site",
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
# IS_DEMO_SITE controls whether or not we show our big red "TEST SITE" banner
|
||||
# underneath the "this is a real government website" banner.
|
||||
IS_DEMO_SITE = True
|
||||
|
||||
# endregion
|
||||
# region: Database----------------------------------------------------------###
|
||||
|
||||
|
|
|
@ -21,3 +21,13 @@ def canonical_path(request):
|
|||
template itself, so we do it here and pass the information on.
|
||||
"""
|
||||
return {"CANONICAL_PATH": request.build_absolute_uri(request.path)}
|
||||
|
||||
|
||||
def is_demo_site(request):
|
||||
"""Add a boolean if this is a demo site.
|
||||
|
||||
To be able to render or not our "demo site" banner, we need a context
|
||||
variable for the template that indicates if this banner should or
|
||||
should not appear.
|
||||
"""
|
||||
return {"IS_DEMO_SITE": settings.IS_DEMO_SITE}
|
||||
|
|
|
@ -103,6 +103,20 @@
|
|||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% if IS_DEMO_SITE %}
|
||||
<section
|
||||
class="usa-site-alert usa-site-alert--emergency usa-site-alert--no-icon"
|
||||
aria-label="Site alert,,,,,"
|
||||
>
|
||||
<div class="usa-alert">
|
||||
<div class="usa-alert__body">
|
||||
<p class="usa-alert__text">
|
||||
<strong>TEST SITE</strong> - Do not use real personal information. Demo purposes only.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% block usa_overlay %}<div class="usa-overlay"></div>{% endblock %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue