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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#21] display version in admin #192

Merged
merged 6 commits into from
Jul 16, 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: 3 additions & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ asgiref==3.8.1
# django-cors-headers
asn1crypto==1.5.1
# via webauthn
async-timeout==4.0.3
# via redis
attrs==23.2.0
# via
# glom
Expand Down Expand Up @@ -227,7 +229,7 @@ mozilla-django-oidc-db==0.15.0
# via open-api-framework
notifications-api-common==0.2.2
# via commonground-api-common
open-api-framework==0.4.2
open-api-framework==0.5.0
# via -r requirements/base.in
orderedmultidict==1.0.1
# via furl
Expand Down
7 changes: 6 additions & 1 deletion requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ asn1crypto==1.5.1
# webauthn
astroid==3.1.0
# via pylint
async-timeout==4.0.3
# via
# -c requirements/base.txt
# -r requirements/base.txt
# redis
attrs==23.2.0
# via
# -c requirements/base.txt
Expand Down Expand Up @@ -479,7 +484,7 @@ notifications-api-common==0.2.2
# -c requirements/base.txt
# -r requirements/base.txt
# commonground-api-common
open-api-framework==0.4.2
open-api-framework==0.5.0
# via
# -c requirements/base.txt
# -r requirements/base.txt
Expand Down
7 changes: 6 additions & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ astroid==3.1.0
# -c requirements/ci.txt
# -r requirements/ci.txt
# pylint
async-timeout==4.0.3
# via
# -c requirements/ci.txt
# -r requirements/ci.txt
# redis
attrs==23.2.0
# via
# -c requirements/ci.txt
Expand Down Expand Up @@ -539,7 +544,7 @@ notifications-api-common==0.2.2
# -c requirements/ci.txt
# -r requirements/ci.txt
# commonground-api-common
open-api-framework==0.4.2
open-api-framework==0.5.0
# via
# -c requirements/ci.txt
# -r requirements/ci.txt
Expand Down
43 changes: 6 additions & 37 deletions src/openklant/scss/admin/_admin_theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ DO NOT PUT ANY TARGET APP-SPECIFIC RULES HERE.
--input-group-text-bg: #{$color-secondary-dark};
--input-group-text-fg: #{$color-dark};
--formio-dropdown-highlighted-bg: #f2f2f2;

// version styling
--version-fg: var(--body-quiet-color);

// environment styling
--env-button-fg: #{$color-secondary};
}

@media (prefers-color-scheme: dark) {
Expand Down Expand Up @@ -263,43 +269,6 @@ div.breadcrumbs {
background: none !important;
}

/* Footer */
.login .version {
text-align: center;
}
.version {
padding: 0 30px;
color: $color_secondary_dark;
font-size: smaller;
}

#footer {
display: flex;
justify-content: space-between;
align-items: center;
}

/**
* Environment banner
*/
.env {
display: block;
line-height: 35px;
text-align: center;
font-weight: bold;
text-transform: uppercase;
color: $color_secondary;
background-color: $color_dark;
position: fixed;
top: 0;
height: 35px;
width: 300px;
left: 50%;
margin-left: -150px;
z-index: 1000001;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.2);
}

/**
* Django form field lengths
*/
Expand Down
19 changes: 1 addition & 18 deletions src/openklant/templates/admin/base_site.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "admin/base.html" %}
{% extends "open_api_framework/admin/base_site.html" %}
{% load i18n static %}

{% block title %}{{ title }} | {{ settings.PROJECT_NAME }}{% endblock %}
Expand Down Expand Up @@ -30,20 +30,3 @@ <h1 id="site-name"><a href="{% url 'admin:index' %}">{{ settings.PROJECT_NAME }}
{% endblock %}

{% block nav-global %}{% endblock %}

{% block messages %}
{% if settings.ENVIRONMENT_SHOWN_IN_ADMIN %}
<div class="env env-{{ settings.ENVIRONMENT }}">{{ settings.ENVIRONMENT }}</div>
{% endif %}
{{ block.super }}
{% endblock %}

{% block footer %}
<div id="footer">
{% if user.is_authenticated and user.is_staff %}
<div class="version" title="Git SHA: {{ settings.GIT_SHA|default:'' }}">
{% blocktrans with version=settings.RELEASE %}version: {{version}}{% endblocktrans %}
</div>
{% endif %}
</div>
{% endblock %}
1 change: 1 addition & 0 deletions src/openklant/utils/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def settings(request):
"SITE_TITLE",
"PROJECT_NAME",
"VNG_COMPONENTS_BRANCH",
"ENVIRONMENT_SHOWN_IN_ADMIN",
"RELEASE",
"GIT_SHA",
)
Expand Down
Loading