From 89adf479f638c5a80d50329af5df1b7baa15edb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Tue, 3 Jan 2023 21:35:09 +0100 Subject: [PATCH] Include version in the footer --- .drone.yml | 4 +- pyproject.toml | 2 +- src/web/tracker/static/base.css | 70 +++++++++++++++++++++++++ src/web/tracker/templates/base.html | 2 + src/web/tracker/templatetags/version.py | 18 +++++++ 5 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 src/web/tracker/templatetags/version.py diff --git a/.drone.yml b/.drone.yml index 66b35a3..c8fcc41 100644 --- a/.drone.yml +++ b/.drone.yml @@ -8,7 +8,9 @@ steps: image: plugins/docker settings: repo: registry.kucharczyk.xyz/timetracker - tags: latest + tags: + - latest + - $(git describe --tags --abbrev=0) trigger: event: - push diff --git a/pyproject.toml b/pyproject.toml index 99a0f88..08dfcac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "timetracker" -version = "0.1.0" +version = "0.0.0" description = "A simple time tracker." authors = ["Lukáš Kucharczyk "] license = "GPL" diff --git a/src/web/tracker/static/base.css b/src/web/tracker/static/base.css index d5c4eb8..7be1c87 100644 --- a/src/web/tracker/static/base.css +++ b/src/web/tracker/static/base.css @@ -717,6 +717,26 @@ select { position: static; } +.absolute { + position: absolute; +} + +.left-0 { + left: 0px; +} + +.bottom-0 { + bottom: 0px; +} + +.left-1 { + left: 0.25rem; +} + +.bottom-1 { + bottom: 0.25rem; +} + .mx-auto { margin-left: auto; margin-right: auto; @@ -848,6 +868,16 @@ select { line-height: 1.75rem; } +.text-sm { + font-size: 0.875rem; + line-height: 1.25rem; +} + +.text-xs { + font-size: 0.75rem; + line-height: 1rem; +} + .font-semibold { font-weight: 600; } @@ -857,6 +887,36 @@ select { color: rgb(255 255 255 / var(--tw-text-opacity)); } +.text-slate-800 { + --tw-text-opacity: 1; + color: rgb(30 41 59 / var(--tw-text-opacity)); +} + +.text-slate-700 { + --tw-text-opacity: 1; + color: rgb(51 65 85 / var(--tw-text-opacity)); +} + +.text-slate-600 { + --tw-text-opacity: 1; + color: rgb(71 85 105 / var(--tw-text-opacity)); +} + +.text-slate-500 { + --tw-text-opacity: 1; + color: rgb(100 116 139 / var(--tw-text-opacity)); +} + +.text-slate-400 { + --tw-text-opacity: 1; + color: rgb(148 163 184 / var(--tw-text-opacity)); +} + +.text-slate-300 { + --tw-text-opacity: 1; + color: rgb(203 213 225 / var(--tw-text-opacity)); +} + .shadow { --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1); --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color); @@ -908,6 +968,11 @@ form input[type=submit] { background-color: rgb(51 65 85 / var(--tw-bg-opacity)); } +.dark .dark\:bg-slate-400 { + --tw-bg-opacity: 1; + background-color: rgb(148 163 184 / var(--tw-bg-opacity)); +} + .dark .dark\:text-white { --tw-text-opacity: 1; color: rgb(255 255 255 / var(--tw-text-opacity)); @@ -923,6 +988,11 @@ form input[type=submit] { color: rgb(203 213 225 / var(--tw-text-opacity)); } +.dark .dark\:text-slate-600 { + --tw-text-opacity: 1; + color: rgb(71 85 105 / var(--tw-text-opacity)); +} + @media (min-width: 768px) { .md\:block { display: block; diff --git a/src/web/tracker/templates/base.html b/src/web/tracker/templates/base.html index b1be850..54a855e 100644 --- a/src/web/tracker/templates/base.html +++ b/src/web/tracker/templates/base.html @@ -32,6 +32,8 @@ {% block content %}No content here.{% endblock %} + {% load version %} + {% version %} ({% version_date %}) \ No newline at end of file diff --git a/src/web/tracker/templatetags/version.py b/src/web/tracker/templatetags/version.py new file mode 100644 index 0000000..054c854 --- /dev/null +++ b/src/web/tracker/templatetags/version.py @@ -0,0 +1,18 @@ +from django import template +import time +import os + +register = template.Library() + + +@register.simple_tag +def version_date(): + return time.strftime( + "%d-%b-%Y %H:%m", + time.gmtime(os.path.getmtime(os.path.abspath(os.path.join(".git")))), + ) + + +@register.simple_tag +def version(): + return os.environ.get("VERSION_NUMBER", "UNKNOWN VERSION")