From 693e1b1cd39e2e3a5be850fcdceaf69876cb2c3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Mon, 9 Oct 2023 20:55:31 +0200 Subject: [PATCH] Add edit buttons to game overview, notes --- CHANGELOG.md | 8 ++ games/static/base.css | 89 ++++++++++++++++++--- games/templates/components/edit_button.html | 21 +++++ games/templates/view_game.html | 44 +++++++++- games/views.py | 1 + 5 files changed, 149 insertions(+), 14 deletions(-) create mode 100644 games/templates/components/edit_button.html diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b0674e..6411024 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## 1.1.1 / 2023-10-09 20:52+02:00 + +### New +* Add notes section to game overview + +### Enhancements +* Make it possible to add any data on the game overview page + ## 1.1.0 / 2023-10-09 00:01+02:00 ### New diff --git a/games/static/base.css b/games/static/base.css index 9e9a129..6743314 100644 --- a/games/static/base.css +++ b/games/static/base.css @@ -811,6 +811,14 @@ select { margin-top: 1rem; } +.ml-8 { + margin-left: 2rem; +} + +.ml-1 { + margin-left: 0.25rem; +} + .block { display: block; } @@ -835,6 +843,14 @@ select { height: 1.5rem; } +.h-4 { + height: 1rem; +} + +.h-5 { + height: 1.25rem; +} + .min-h-screen { min-height: 100vh; } @@ -847,6 +863,14 @@ select { width: 100%; } +.w-5 { + width: 1.25rem; +} + +.w-7 { + width: 1.75rem; +} + .max-w-screen-lg { max-width: 1024px; } @@ -881,6 +905,10 @@ select { align-items: center; } +.justify-center { + justify-content: center; +} + .justify-between { justify-content: space-between; } @@ -927,6 +955,16 @@ select { background-color: rgb(255 255 255 / var(--tw-bg-opacity)); } +.bg-blue-600 { + --tw-bg-opacity: 1; + background-color: rgb(37 99 235 / var(--tw-bg-opacity)); +} + +.bg-violet-600 { + --tw-bg-opacity: 1; + background-color: rgb(124 58 237 / var(--tw-bg-opacity)); +} + .p-4 { padding: 1rem; } @@ -954,6 +992,10 @@ select { padding-right: 1rem; } +.pl-8 { + padding-left: 2rem; +} + .text-center { text-align: center; } @@ -996,6 +1038,10 @@ select { font-weight: 600; } +.italic { + font-style: italic; +} + .text-slate-300 { --tw-text-opacity: 1; color: rgb(203 213 225 / var(--tw-text-opacity)); @@ -1236,6 +1282,16 @@ th label { background-color: rgb(21 128 61 / var(--tw-bg-opacity)); } +.hover\:bg-blue-700:hover { + --tw-bg-opacity: 1; + background-color: rgb(29 78 216 / var(--tw-bg-opacity)); +} + +.hover\:bg-violet-700:hover { + --tw-bg-opacity: 1; + background-color: rgb(109 40 217 / var(--tw-bg-opacity)); +} + .hover\:underline:hover { text-decoration-line: underline; } @@ -1256,6 +1312,16 @@ th label { --tw-ring-color: rgb(34 197 94 / var(--tw-ring-opacity)); } +.focus\:ring-blue-500:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity)); +} + +.focus\:ring-violet-500:focus { + --tw-ring-opacity: 1; + --tw-ring-color: rgb(139 92 246 / var(--tw-ring-opacity)); +} + .focus\:ring-offset-2:focus { --tw-ring-offset-width: 2px; } @@ -1264,6 +1330,10 @@ th label { --tw-ring-offset-color: #bfdbfe; } +.focus\:ring-offset-violet-200:focus { + --tw-ring-offset-color: #ddd6fe; +} + :is(.dark .dark\:bg-gray-800) { --tw-bg-opacity: 1; background-color: rgb(31 41 55 / var(--tw-bg-opacity)); @@ -1274,6 +1344,11 @@ th label { background-color: rgb(17 24 39 / var(--tw-bg-opacity)); } +:is(.dark .dark\:text-slate-500) { + --tw-text-opacity: 1; + color: rgb(100 116 139 / var(--tw-text-opacity)); +} + :is(.dark .dark\:text-slate-600) { --tw-text-opacity: 1; color: rgb(71 85 105 / var(--tw-text-opacity)); @@ -1284,16 +1359,6 @@ th label { color: rgb(255 255 255 / var(--tw-text-opacity)); } -:is(.dark .dark\:text-slate-400) { - --tw-text-opacity: 1; - color: rgb(148 163 184 / var(--tw-text-opacity)); -} - -:is(.dark .dark\:text-slate-500) { - --tw-text-opacity: 1; - color: rgb(100 116 139 / var(--tw-text-opacity)); -} - @media (min-width: 640px) { .sm\:inline { display: inline; @@ -1320,6 +1385,10 @@ th label { padding-left: 0.5rem; } + .sm\:pl-4 { + padding-left: 1rem; + } + .sm\:decoration-2 { text-decoration-thickness: 2px; } diff --git a/games/templates/components/edit_button.html b/games/templates/components/edit_button.html new file mode 100644 index 0000000..3a5ab35 --- /dev/null +++ b/games/templates/components/edit_button.html @@ -0,0 +1,21 @@ + + + diff --git a/games/templates/view_game.html b/games/templates/view_game.html index 8f9c25b..fd61dff 100644 --- a/games/templates/view_game.html +++ b/games/templates/view_game.html @@ -6,7 +6,12 @@ {% block content %}
-

{{ game.name }} (#{{ game.pk }})

+

+ {{ game.name }} + (#{{ game.pk }}) + {% url 'edit_game' game.id as edit_url %} + {% include 'components/edit_button.html' with edit_url=edit_url %} +

{{ total_hours }} total {{ session_average }} avg @@ -17,7 +22,7 @@

Editions ({{ editions.count }})

Purchases ({{ purchases.count }})

Sessions ({{ sessions.count }})

+

Notes ({{ sessions_with_notes.count }})

+ diff --git a/games/views.py b/games/views.py index 2a545f1..1684f79 100644 --- a/games/views.py +++ b/games/views.py @@ -112,6 +112,7 @@ def view_game(request, game_id=None): # so the most recent are on top context["last_session"] = context["sessions"].first() context["first_session"] = context["sessions"].last() + context["sessions_with_notes"] = context["sessions"].exclude(note="") return render(request, "view_game.html", context)