Skip to content

Commit

Permalink
[#21] reuse open-api-framework admin template
Browse files Browse the repository at this point in the history
  • Loading branch information
Sonny Bakker committed Jun 20, 2024
1 parent bae1475 commit 1c6189e
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 57 deletions.
2 changes: 1 addition & 1 deletion requirements/base.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
open-api-framework
git+https://github.com/maykinmedia/open-api-framework@bd51d3f592b4f1088e2233f98c90c6fd67c60e0c#egg=open_api_framework

# Core python libraries
glom # data represenation based on spec
Expand Down
10 changes: 7 additions & 3 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ django-jsonform==2.21.4
# mozilla-django-oidc-db
# open-api-framework
django-log-outgoing-requests==0.6.1
# via -r requirements/base.in
# via
# -r requirements/base.in
# open-api-framework
django-markup==1.8.1
# via open-api-framework
django-ordered-model==3.7.4
Expand All @@ -139,7 +141,9 @@ django-rest-framework-condition==0.1.1
django-sendfile2==0.7.0
# via django-privates
django-setup-configuration==0.1.0
# via -r requirements/base.in
# via
# -r requirements/base.in
# open-api-framework
django-simple-certmanager==1.4.1
# via zgw-consumers
django-solo==2.2.0
Expand Down Expand Up @@ -232,7 +236,7 @@ notifications-api-common==0.2.2
# via
# -r requirements/base.in
# commonground-api-common
open-api-framework==0.2.0
open-api-framework @ git+https://github.com/maykinmedia/open-api-framework@bd51d3f592b4f1088e2233f98c90c6fd67c60e0c
# via -r requirements/base.in
orderedmultidict==1.0.1
# via furl
Expand Down
10 changes: 7 additions & 3 deletions requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ django-jsonform==2.21.4
# mozilla-django-oidc-db
# open-api-framework
django-log-outgoing-requests==0.6.1
# via -r requirements/base.txt
# via
# -r requirements/base.txt
# open-api-framework
django-markup==1.8.1
# via
# -r requirements/base.txt
Expand Down Expand Up @@ -209,7 +211,9 @@ django-sendfile2==0.7.0
# -r requirements/base.txt
# django-privates
django-setup-configuration==0.1.0
# via -r requirements/base.txt
# via
# -r requirements/base.txt
# open-api-framework
django-simple-certmanager==1.4.1
# via
# -r requirements/base.txt
Expand Down Expand Up @@ -365,7 +369,7 @@ notifications-api-common==0.2.2
# via
# -r requirements/base.txt
# commonground-api-common
open-api-framework==0.2.0
open-api-framework @ git+https://github.com/maykinmedia/open-api-framework@bd51d3f592b4f1088e2233f98c90c6fd67c60e0c
# via -r requirements/base.txt
orderedmultidict==1.0.1
# via
Expand Down
10 changes: 7 additions & 3 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ django-jsonform==2.21.4
# mozilla-django-oidc-db
# open-api-framework
django-log-outgoing-requests==0.6.1
# via -r requirements/ci.txt
# via
# -r requirements/ci.txt
# open-api-framework
django-markup==1.8.1
# via
# -r requirements/ci.txt
Expand Down Expand Up @@ -235,7 +237,9 @@ django-sendfile2==0.7.0
# -r requirements/ci.txt
# django-privates
django-setup-configuration==0.1.0
# via -r requirements/ci.txt
# via
# -r requirements/ci.txt
# open-api-framework
django-simple-certmanager==1.4.1
# via
# -r requirements/ci.txt
Expand Down Expand Up @@ -410,7 +414,7 @@ notifications-api-common==0.2.2
# via
# -r requirements/ci.txt
# commonground-api-common
open-api-framework==0.2.0
open-api-framework @ git+https://github.com/maykinmedia/open-api-framework@bd51d3f592b4f1088e2233f98c90c6fd67c60e0c
# via -r requirements/ci.txt
orderedmultidict==1.0.1
# via
Expand Down
2 changes: 2 additions & 0 deletions src/objects/conf/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
"simple_certmanager",
"zgw_consumers",
"django_setup_configuration",
"open_api_framework",
# Two-factor authentication in the Django admin, enforced.
"django_otp",
"django_otp.plugins.otp_static",
Expand Down Expand Up @@ -163,6 +164,7 @@
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
"open_api_framework.context_processors.project",
"objects.utils.context_processors.settings",
],
"loaders": RAW_TEMPLATE_LOADERS,
Expand Down
38 changes: 6 additions & 32 deletions src/objects/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: #{$color-secondary-dark};

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

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

/* Footer */
.version {
padding: 0 40px;
color: $color-secondary-dark;
font-size: smaller;

@at-root .login & {
text-align: 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
17 changes: 2 additions & 15 deletions src/objects/templates/admin/base_site.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{% extends "admin/base.html" %}
{% extends "open_api_framework/admin/base_site.html" %}
{% load i18n static %}

{% block title %}{{ title }} | {{ settings.PROJECT_NAME }}{% endblock %}

{% block extrastyle %}
{{ block.super }}

<link rel="stylesheet" type="text/css" href="{% static 'bundles/admin_overrides.css' %}">

<link rel="icon" type="image/png" href="{% static 'ico/favicon.png' %}">
Expand Down Expand Up @@ -35,23 +36,9 @@ <h1 id="site-name"><a href="{% url 'admin:index' %}">{{ settings.PROJECT_NAME }}

{% 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 %}
{{ block.super }}

{% url 'admin:login' as admin_login_url %}
{% if request.path != admin_login_url %}
<div class="version" title="Git SHA: {{ settings.GIT_SHA|default:'' }}">
{% blocktrans with version=settings.RELEASE %}version {{ version }}{% endblocktrans %}
</div>
{% endif %}

{# Load the custom JS #}
<script src="{% static 'bundles/objects-js.js' %}"></script>
{% endblock %}

0 comments on commit 1c6189e

Please sign in to comment.