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] show version in admin #14

Merged
merged 8 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
2 changes: 2 additions & 0 deletions 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
4 changes: 4 additions & 0 deletions requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ asn1crypto==1.5.1
# via
# -r requirements/base.txt
# webauthn
async-timeout==4.0.3
# via
# -r requirements/base.txt
# redis
attrs==23.2.0
# via
# -r requirements/base.txt
Expand Down
5 changes: 5 additions & 0 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ asn1crypto==1.5.1
# -c requirements/ci.txt
# -r requirements/ci.txt
# webauthn
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
1 change: 1 addition & 0 deletions src/referentielijsten/conf/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
os.environ.setdefault("DB_USER", "referentielijsten")
os.environ.setdefault("DB_PASSWORD", "referentielijsten")

os.environ.setdefault("RELEASE", "dev")
os.environ.setdefault("ENVIRONMENT", "development")

from .base import * # noqa isort:skip
Expand Down
37 changes: 6 additions & 31 deletions src/referentielijsten/scss/admin/_admin_theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ DO NOT PUT ANY TARGET APP-SPECIFIC RULES HERE.

--object-tools-bg: #888;
--object-tools-hover-bg: #{$color_dark};

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

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

/* Overrides */
Expand Down Expand Up @@ -132,37 +138,6 @@ div.breadcrumbs {
background: url("../img/admin/calendar-alt-regular.svg") 0 0/14px 14px no-repeat !important;
}

/* Footer */

.version {
color: var(--body-fg);
padding: 0 30px;
font-size: smaller;
display: flex;
flex-direction: column;
}

/**
* 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
11 changes: 1 addition & 10 deletions src/referentielijsten/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 utils %}

{% block title %}
Expand Down Expand Up @@ -47,12 +47,3 @@ <h1 id="site-name">

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

{# Override footer block to display version information if you're a logged in staff user #}
{% block footer %}
<div id="footer">
{% if user.is_authenticated and user.is_staff %}
{% show_version_info %}
{% endif %}
</div>
{% endblock %}
1 change: 1 addition & 0 deletions src/referentielijsten/utils/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ def settings(request):
public_settings = (
"GOOGLE_ANALYTICS_ID",
"ENVIRONMENT",
"ENVIRONMENT_SHOWN_IN_ADMIN",
"PROJECT_NAME",
)

Expand Down
9 changes: 0 additions & 9 deletions src/referentielijsten/utils/templatetags/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django import template
from django.conf import settings
from django.utils.html import format_html

register = template.Library()
Expand Down Expand Up @@ -63,11 +62,3 @@ def placekitten_src(width=800, height=600):
{% include 'components/image/image.html' with mobile_src=mobile_src src=src alt='placekitten' only %}
"""
return "//placekitten.com/{}/{}".format(width, height)


@register.inclusion_tag("utils/includes/version_info.html")
def show_version_info():
return {
"RELEASE": settings.RELEASE,
"GIT_SHA": settings.GIT_SHA,
}
Loading