Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display warning banner on test sites #76

Merged
merged 3 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cdhweb/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,7 @@ def favicon_path():
icon_version = "favicon-test.ico"

return "".join([settings.STATIC_URL, base_path, icon_version])


def show_test_warning(request):
return {"SHOW_TEST_WARNING": getattr(settings, "SHOW_TEST_WARNING", False)}
3 changes: 2 additions & 1 deletion cdhweb/settings/components/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
"cdhweb.context_processors.template_settings",
"cdhweb.pages.context_processors.page_intro",
"cdhweb.pages.context_processors.site_search",
"cdhweb.context_processors.show_test_warning",
],
},
},
Expand Down Expand Up @@ -450,4 +451,4 @@

# Springkit Settings
BILINGUAL_HEADINGS = False
BILINGUAL_LINKS = False
BILINGUAL_LINKS = False
2 changes: 1 addition & 1 deletion cdhweb/settings/environments/test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

from cdhweb.settings import BASE_DIR, DATABASES
from cdhweb.settings import DATABASES

# These settings correspond to the service container settings in the
# .github/workflow .yml files.
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ services:
- ".:/app"
ports:
- "${PORT_PREFIX:-561}80:8000"
# env_file:
# - dev.env
environment:
VIRTUAL_HOST: "cdh.dev.springload.nz"
VIRTUAL_PORT: 8000
Expand Down
12 changes: 9 additions & 3 deletions templates/includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@
{% secondary_navigation as secondary_nav %}

<header class="header">
{% site_alerts %}
{% site_alerts %}

{% if SHOW_TEST_WARNING %}
<div style="background-color: yellow; text-align: center; padding: 10px;">
This is a test site.
</div>
{% endif %}

<nav class="main-nav-mobile" data-component="main-nav-mobile" aria-label="Main" data-search-url="{% url 'search' %}">
{# the following gets swapped out when react component mounts #}
Expand Down Expand Up @@ -61,8 +67,8 @@
<a href="{{ secondary_nav.cta_button.link_url }}" class="sk-btn sk-btn--secondary main-nav-desktop__cta">{{ secondary_nav.cta_button.title }}</a>
</li>
{% endif %}
</ul>
</ul>

</div>
</nav>
</header>
</header>
Loading