diff --git a/Makefile b/Makefile index 40a2be82..62a57a83 100644 --- a/Makefile +++ b/Makefile @@ -48,6 +48,10 @@ migrate: clear @docker-compose run --rm web python manage.py migrate +collectstatic: + clear + @docker-compose run --rm web python manage.py collectstatic --noinput + shell: clear @docker-compose run --rm web python manage.py shell diff --git a/app/app/settings.py b/app/app/settings.py index 7ddaf0ee..d9124599 100644 --- a/app/app/settings.py +++ b/app/app/settings.py @@ -58,7 +58,10 @@ TEMPLATES = [ { "BACKEND": "django.template.backends.django.DjangoTemplates", - "DIRS": [], + "DIRS": [ + BASE_DIR, + "templates", + ], "APP_DIRS": True, "OPTIONS": { "context_processors": [ @@ -120,6 +123,9 @@ # https://docs.djangoproject.com/en/5.0/howto/static-files/ STATIC_URL = "static/" +STATICFILES_DIRS = [ + BASE_DIR / "static", +] # Default primary key field type # https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field diff --git a/app/app/urls.py b/app/app/urls.py index b4dd8616..e41c9e18 100644 --- a/app/app/urls.py +++ b/app/app/urls.py @@ -18,6 +18,12 @@ from django.contrib import admin from django.urls import path +from . import views + +admin.site.index_title = "SADiLaR Administration" +admin.site.site_title = "SADiLaR Site Admin Portal" + urlpatterns = [ path("admin/", admin.site.urls), + path("", views.home, name="home"), ] diff --git a/app/app/views.py b/app/app/views.py new file mode 100644 index 00000000..e9e360ce --- /dev/null +++ b/app/app/views.py @@ -0,0 +1,8 @@ +from django.shortcuts import render + + +def home(request): + template = "app/home.html" + context = {} + + return render(request, template_name=template, context=context) diff --git a/app/general/views.py b/app/general/views.py deleted file mode 100644 index fd0e0449..00000000 --- a/app/general/views.py +++ /dev/null @@ -1,3 +0,0 @@ -# from django.shortcuts import render - -# Create your views here. diff --git a/app/static/css/admin.css b/app/static/css/admin.css new file mode 100644 index 00000000..0669673e --- /dev/null +++ b/app/static/css/admin.css @@ -0,0 +1,63 @@ +/* + Django admin styles + extended from https://github.com/django/django/blob/main/django/contrib/admin/static/admin/css/base.css + Remember to sync colours with front-end CSS. +*/ + +/* VARIABLE DEFINITIONS */ +html[data-theme="light"], +:root { + --primary: #1a2f69; + --primary-light: #8288bc; + + --header-color: var(--primary-light); + --header-branding-color: var(--primary-light); + --header-bg: var(--primary); + --header-link-color: #000000; + + --breadcrumbs-bg: var(--primary-light); + + --link-fg: var(--primary); + --link-selected-fg: var(--primary); + + --message-success-bg: #9fadd1; + --message-warning-bg: var(--primary-light); + + --selected-row: var(--primary-light); + + --button-bg: var(--primary); + --button-hover-bg: #485D95; + --default-button-bg:#485D95; + --default-button-hover-bg: var(--primary); +} + +/* LINKS */ +a.section:link, a.section:visited { + color: #ffffff; +} + +/* HEADER */ +#header { + padding: 3px 15px 0 10px; + background: #ffffff; + color: #000; +} + +#header a:link, #header a:visited, #logout-form button { + color: var(--link-fg); +} + +.theme-toggle svg.theme-icon-when-auto, .theme-toggle svg.theme-icon-when-dark, .theme-toggle svg.theme-icon-when-light { + fill: var(--link-fg); + color: #fff; +} + +.header-title { + margin: 10px; +} + +.main-logo { + margin-left: 1px; + width: auto; + height: 70px; +} diff --git a/app/static/css/styles.css b/app/static/css/styles.css new file mode 100755 index 00000000..ec6de953 --- /dev/null +++ b/app/static/css/styles.css @@ -0,0 +1,119 @@ +/* Remember to sync colours with admin CSS. */ +:root { + --primary: #1a2f69; + --primary-light: #8288bc; + --primary-red: #d11f26; + --primary-fg: #ffffff; + --body-quiet-color: #485d95; + --text-color: #000000; +} + +body { + margin: 0; + padding: 0; +} + +.header-container { + display: inline-block; +} + +.nav-menu { + float: left; + padding: 5px; + margin: 10px 10px 10px 10px; +} + +.nav-logo { + margin: 3px 10px 10px 10px; + float: left; +} + +.nav { + background: var(--primary-fg); + width: 100%; +} + +.nav > li > a{ + margin-top: 15px; + color: var(--text-color); +} + +.nav > li > .active{ + margin-top: 15px; + background-color: var(--primary) !important; + color: var(--primary-fg); +} + +.nav > li > a:hover{ + margin-top: 15px; + background-color: var(--body-quiet-color); + color: var(--primary-fg); +} + +.nav > li > a:active{ + margin-top: 15px; + background-color: var(--primary); + color: var(--primary); +} + +.btn-primary{ + margin-top:20px; + outline-color: var(--primary); + background-color: var(--primary); + border-color: var(--primary); +} + +.btn-outline-primary{ + margin-top:20px; + background: #2D4481; + outline-color: var(--primary); +} + +.btn-primary:hover{ + margin-top:20px; + background: var(--body-quiet-color); + outline-color: var(--primary); +} + +.app-footer .footer-title { + color: var(--primary); +} + +.card{ + border-color: var(--primary-red); + margin-right: 50px; +} + +.fa-search{ + margin-right: 30px; +} + +.footer { + color: white; + background: var(--primary); + width: 100%; +} + +.footer > a { + color: var(--primary-fg); +} + +.section{ + margin-left: 10px; + margin-right: 10px; + margin-bottom: 10px; +} + +.input-group{ + margin: 10px 10px 10px 10px; +} + +.form-group{ + margin-bottom: 10px; +} + +.main-logo { + width: 140px; + height: 75px; + margin: 10px 10px 10px 10px; +} diff --git a/app/static/img/sadilar.png b/app/static/img/sadilar.png new file mode 100644 index 00000000..d8be30d0 Binary files /dev/null and b/app/static/img/sadilar.png differ diff --git a/app/templates/admin/base_site.html b/app/templates/admin/base_site.html new file mode 100644 index 00000000..38b7f2a8 --- /dev/null +++ b/app/templates/admin/base_site.html @@ -0,0 +1,25 @@ + + +{% extends "admin/base.html" %} + +{% load static %} + +{% block title %}{% if subtitle %}{{ subtitle }} | {% endif %}{{ title }} | {{ site_title|default:_('Django site admin') }}{% endblock %} + +{% block extrastyle %} + +{% endblock %} + +{% block branding %} +
+ South African Centre for Digital Language Resources +
++ Terminology Management System +
+