replace slippers with django-cotton
main reason: slippers cannot pass request via context inside its components, making it annoying to use template takes that take request. more reasons: not actively worked on, no named slots, having to define components in components.yaml + new components do not get registered without restarting server
This commit is contained in:
parent
9af4c79947
commit
b8258e2937
|
@ -15,4 +15,6 @@ repos:
|
|||
rev: v1.34.0
|
||||
hooks:
|
||||
- id: djlint-reformat-django
|
||||
args: ["--ignore", "H011"]
|
||||
- id: djlint-django
|
||||
args: ["--ignore", "H011"]
|
||||
|
|
|
@ -17,10 +17,10 @@ def Popover(
|
|||
result = mark_safe(
|
||||
str(content)
|
||||
+ render_to_string(
|
||||
"components/popover.html",
|
||||
"cotton/popover.html",
|
||||
{
|
||||
"id": id,
|
||||
"children": popover_content,
|
||||
"slot": popover_content,
|
||||
},
|
||||
)
|
||||
)
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
components:
|
||||
gamelink: "components/game_link.html"
|
||||
popover: "components/popover.html"
|
||||
table: "components/table.html"
|
||||
table_row: "components/table_row.html"
|
||||
table_td: "components/table_td.html"
|
||||
simple_table: "components/simple_table.html"
|
||||
button_group_sm: "components/button_group_sm.html"
|
||||
button_group_button_sm: "components/button_group_button_sm.html"
|
||||
h1: "components/h1.html"
|
|
@ -1,5 +0,0 @@
|
|||
<div class="inline-flex rounded-md shadow-sm" role="group">
|
||||
{% for button in buttons %}
|
||||
{% button_group_button_sm href=button.href text=button.text color=button.color %}
|
||||
{% endfor %}
|
||||
</div>
|
|
@ -1,13 +0,0 @@
|
|||
<a href="{{ edit_url }}">
|
||||
<button type="button"
|
||||
title="Edit"
|
||||
class="ml-1 py-1 px-2 flex justify-center items-center bg-violet-600 hover:bg-violet-700 focus:ring-violet-500 focus:ring-offset-violet-200 text-white transition ease-in duration-200 text-center text-base font-semibold shadow-md focus:outline-none focus:ring-2 focus:ring-offset-2 w-7 h-4 rounded-lg">
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 20 20"
|
||||
fill="currentColor"
|
||||
class="w-5 h-5">
|
||||
<path d="M5.433 13.917l1.262-3.155A4 4 0 017.58 9.42l6.92-6.918a2.121 2.121 0 013 3l-6.92 6.918c-.383.383-.84.685-1.343.886l-3.154 1.262a.5.5 0 01-.65-.65z" />
|
||||
<path d="M3.5 5.75c0-.69.56-1.25 1.25-1.25H10A.75.75 0 0010 3H4.75A2.75 2.75 0 002 5.75v9.5A2.75 2.75 0 004.75 18h9.5A2.75 2.75 0 0017 15.25V10a.75.75 0 00-1.5 0v5.25c0 .69-.56 1.25-1.25 1.25h-9.5c-.69 0-1.25-.56-1.25-1.25v-9.5z" />
|
||||
</svg>
|
||||
</button>
|
||||
</a>
|
|
@ -1,15 +0,0 @@
|
|||
{% fragment as default_content %}
|
||||
{% for td in data %}
|
||||
{% if forloop.first %}
|
||||
<th scope="row"
|
||||
class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white">{{ td }}</th>
|
||||
{% else %}
|
||||
{% #table_td %}
|
||||
{{ td }}
|
||||
{% /table_td %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfragment %}
|
||||
<tr class="odd:bg-white odd:dark:bg-gray-900 even:bg-gray-50 even:dark:bg-gray-800 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600 border-b">
|
||||
{{ children|default:default_content }}
|
||||
</tr>
|
|
@ -1 +0,0 @@
|
|||
<td class="px-6 py-4 min-w-20-char max-w-20-char">{{ children }}</td>
|
|
@ -0,0 +1,4 @@
|
|||
<button type="button"
|
||||
class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 mt-2 dark:bg-blue-600 dark:hover:bg-blue-700 focus:outline-none dark:focus:ring-blue-800">
|
||||
{{ text }}
|
||||
</button>
|
|
@ -1,4 +1,4 @@
|
|||
{% var color=color|default:"gray" %}
|
||||
<c-vars color="gray" />
|
||||
<a href="{{ href }}"
|
||||
class="[&:first-of-type_button]:rounded-s-lg [&:last-of-type_button]:rounded-e-lg">
|
||||
{% if color == "gray" %}
|
|
@ -0,0 +1,6 @@
|
|||
<c-vars color="gray" />
|
||||
<div class="inline-flex rounded-md shadow-sm" role="group">
|
||||
{% for button in buttons %}
|
||||
<c-button-group-button-sm :href=button.href :text=button.text :color=button.color />
|
||||
{% endfor %}
|
||||
</div>
|
|
@ -1,8 +1,8 @@
|
|||
<span class="truncate-container">
|
||||
<a class="underline decoration-slate-500 sm:decoration-2"
|
||||
href="{% url 'view_game' game_id %}">
|
||||
{% if children %}
|
||||
{{ children }}
|
||||
{% if slot %}
|
||||
{{ slot }}
|
||||
{% else %}
|
||||
{{ name }}
|
||||
{% endif %}
|
|
@ -1,5 +1,5 @@
|
|||
<h1 class="{% if badge %}flex items-center {% endif %}mb-4 text-3xl font-extrabold leading-none tracking-tight text-gray-900 dark:text-white">
|
||||
{{ children }}
|
||||
{{ slot }}
|
||||
{% if badge %}
|
||||
<span class="bg-blue-100 text-blue-800 text-2xl font-semibold me-2 px-2.5 py-0.5 rounded dark:bg-blue-200 dark:text-blue-800 ms-2">
|
||||
{{ badge }}
|
|
@ -2,6 +2,6 @@
|
|||
id="{{ id }}"
|
||||
role="tooltip"
|
||||
class="absolute z-10 invisible inline-block text-sm text-white transition-opacity duration-300 bg-white border border-purple-200 rounded-lg shadow-sm opacity-0 dark:text-white dark:border-purple-600 dark:bg-purple-800">
|
||||
<div class="px-3 py-2">{{ children }}</div>
|
||||
<div class="px-3 py-2">{{ slot }}</div>
|
||||
<div data-popper-arrow></div>
|
||||
</div>
|
|
@ -1,3 +1,4 @@
|
|||
{% load param_utils %}
|
||||
<div class="shadow-md sm:rounded-lg" hx-boost="false">
|
||||
<div class="relative overflow-x-auto sm:rounded-lg">
|
||||
<table class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400">
|
||||
|
@ -7,9 +8,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for row in rows %}
|
||||
{% table_row data=row %}
|
||||
{% endfor %}
|
||||
{% for row in rows %}<c-table-row :data=row />{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
@ -20,7 +19,7 @@
|
|||
<ul class="inline-flex -space-x-px rtl:space-x-reverse text-sm h-8">
|
||||
<li>
|
||||
{% if page_obj.has_previous %}
|
||||
<a href="?page={{ page_obj.previous_page_number }}"
|
||||
<a href="?{% param_replace page=page_obj.previous_page_number %}"
|
||||
class="flex items-center justify-center px-3 h-8 ms-0 leading-tight text-gray-500 bg-white border border-gray-300 rounded-s-lg hover:bg-gray-100 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white">Previous</a>
|
||||
{% else %}
|
||||
<a aria-current="page"
|
||||
|
@ -29,7 +28,7 @@
|
|||
{% for page in elided_page_range %}
|
||||
<li>
|
||||
{% if page != page_obj.number %}
|
||||
<a href="?page={{ page }}"
|
||||
<a href="?{% param_replace page=page %}"
|
||||
class="flex items-center justify-center px-3 h-8 leading-tight text-gray-500 bg-white border border-gray-300 hover:bg-gray-100 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white">{{ page }}</a>
|
||||
{% else %}
|
||||
<a aria-current="page"
|
||||
|
@ -38,7 +37,7 @@
|
|||
</li>
|
||||
{% endfor %}
|
||||
{% if page_obj.has_next %}
|
||||
<a href="?page={{ page_obj.next_page_number }}"
|
||||
<a href="?{% param_replace page=page_obj.next_page_number %}"
|
||||
class="flex items-center justify-center px-3 h-8 leading-tight text-gray-500 bg-white border border-gray-300 rounded-e-lg hover:bg-gray-100 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white">Next</a>
|
||||
{% else %}
|
||||
<a aria-current="page"
|
|
@ -6,7 +6,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{ children }}
|
||||
{{ slot }}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
|
@ -0,0 +1,16 @@
|
|||
<tr class="odd:bg-white odd:dark:bg-gray-900 even:bg-gray-50 even:dark:bg-gray-800 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600 border-b">
|
||||
{% if slot %}
|
||||
{{ slot }}
|
||||
{% else %}
|
||||
{% for td in data %}
|
||||
{% if forloop.first %}
|
||||
<th scope="row"
|
||||
class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white">{{ td }}</th>
|
||||
{% else %}
|
||||
<c-table-td>
|
||||
{{ td }}
|
||||
</c-table-td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</tr>
|
|
@ -0,0 +1 @@
|
|||
<td class="px-6 py-4 min-w-20-char max-w-20-char">{{ slot }}</td>
|
|
@ -5,6 +5,6 @@
|
|||
{% endblock title %}
|
||||
{% block content %}
|
||||
<div class="2xl:max-w-screen-2xl md:max-w-screen-md sm:max-w-screen-sm self-center">
|
||||
{% simple_table columns=data.columns rows=data.rows page_obj=page_obj elided_page_range=elided_page_range %}
|
||||
<c-simple-table :columns=data.columns :rows=data.rows :page_obj=page_obj :elided_page_range=elided_page_range />
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
{% load static %}
|
||||
{% partialdef purchase-name %}
|
||||
{% if purchase.type != 'game' %}
|
||||
{% #gamelink game_id=purchase.edition.game.id %}
|
||||
<c-gamelink :game_id=purchase.edition.game.id>
|
||||
{{ purchase.name }} ({{ purchase.edition.name }} {{ purchase.get_type_display }})
|
||||
{% /gamelink %}
|
||||
</c-gamelink>
|
||||
{% else %}
|
||||
{% gamelink game_id=purchase.edition.game.id name=purchase.edition.name %}
|
||||
<c-gamelink :game_id=purchase.edition.game.id name=purchase.edition.name />
|
||||
{% endif %}
|
||||
{% endpartialdef %}
|
||||
{% block content %}
|
||||
|
@ -65,31 +65,31 @@
|
|||
<tr>
|
||||
<td class="px-2 sm:px-4 md:px-6 md:py-2">Longest session</td>
|
||||
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">
|
||||
{{ longest_session_time }} ({% gamelink game_id=longest_session_game.id name=longest_session_game.name %})
|
||||
{{ longest_session_time }} (<c-gamelink :game_id=longest_session_game.id :name=longest_session_game.name />)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="px-2 sm:px-4 md:px-6 md:py-2">Most sessions</td>
|
||||
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">
|
||||
{{ highest_session_count }} ({% gamelink game_id=highest_session_count_game.id name=highest_session_count_game.name %})
|
||||
{{ highest_session_count }} (<c-gamelink :game_id=highest_session_count_game.id :name=highest_session_count_game.name />)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="px-2 sm:px-4 md:px-6 md:py-2">Highest session average</td>
|
||||
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">
|
||||
{{ highest_session_average }} ({% gamelink game_id=highest_session_average_game.id name=highest_session_average_game.name %})
|
||||
{{ highest_session_average }} (<c-gamelink :game_id=highest_session_average_game.id :name=highest_session_average_game.name />)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="px-2 sm:px-4 md:px-6 md:py-2">First play</td>
|
||||
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">
|
||||
{% gamelink game_id=first_play_game.id name=first_play_game.name %} ({{ first_play_date }})
|
||||
<c-gamelink :game_id=first_play_game.id :name=first_play_game.name /> ({{ first_play_date }})
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="px-2 sm:px-4 md:px-6 md:py-2">Last play</td>
|
||||
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">
|
||||
{% gamelink game_id=last_play_game.id name=last_play_game.name %} ({{ last_play_date }})
|
||||
<c-gamelink :game_id=last_play_game.id :name=last_play_game.name /> ({{ last_play_date }})
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -151,7 +151,9 @@
|
|||
<tbody>
|
||||
{% for game in top_10_games_by_playtime %}
|
||||
<tr>
|
||||
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{% gamelink game_id=game.id name=game.name %}</td>
|
||||
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">
|
||||
<c-gamelink :game_id=game.id :name=game.name />
|
||||
</td>
|
||||
<td class="px-2 sm:px-4 md:px-6 md:py-2 font-mono">{{ game.formatted_playtime }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
<div class="flex gap-5 mb-3">
|
||||
<span class="text-wrap max-w-80 text-4xl">
|
||||
<span class="font-bold font-serif">{{ game.name }}</span> <span data-popover-target="popover-year" class="text-slate-500 text-2xl">{{ game.year_released }}</span>
|
||||
{% #popover id="popover-year" %}
|
||||
<c-popover id="popover-year">
|
||||
Original release year
|
||||
{% /popover %}
|
||||
</c-popover>
|
||||
</span>
|
||||
</div>
|
||||
<div class="flex gap-4 dark:text-slate-400 mb-3">
|
||||
|
@ -26,9 +26,9 @@
|
|||
<path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />
|
||||
</svg>
|
||||
{{ hours_sum }}
|
||||
{% #popover id="popover-hours" %}
|
||||
<c-popover id="popover-hours">
|
||||
Total hours played
|
||||
{% /popover %}
|
||||
</c-popover>
|
||||
</span>
|
||||
<span data-popover-target="popover-sessions"
|
||||
class="flex gap-2 items-center">
|
||||
|
@ -41,9 +41,9 @@
|
|||
<path stroke-linecap="round" stroke-linejoin="round" d="M5.25 8.25h15m-16.5 7.5h15m-1.8-13.5-3.9 19.5m-2.1-19.5-3.9 19.5" />
|
||||
</svg>
|
||||
{{ session_count }}
|
||||
{% #popover id="popover-sessions" %}
|
||||
<c-popover id="popover-sessions">
|
||||
Number of sessions
|
||||
{% /popover %}
|
||||
</c-popover>
|
||||
</span>
|
||||
<span data-popover-target="popover-average" class="flex gap-2 items-center">
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
|
@ -55,9 +55,9 @@
|
|||
<path stroke-linecap="round" stroke-linejoin="round" d="M7.5 14.25v2.25m3-4.5v4.5m3-6.75v6.75m3-9v9M6 20.25h12A2.25 2.25 0 0 0 20.25 18V6A2.25 2.25 0 0 0 18 3.75H6A2.25 2.25 0 0 0 3.75 6v12A2.25 2.25 0 0 0 6 20.25Z" />
|
||||
</svg>
|
||||
{{ session_average_without_manual }}
|
||||
{% #popover id="popover-average" %}
|
||||
<c-popover id="popover-average">
|
||||
Average playtime per session
|
||||
{% /popover %}
|
||||
</c-popover>
|
||||
</span>
|
||||
<span data-popover-target="popover-playrange"
|
||||
class="flex gap-2 items-center">
|
||||
|
@ -70,9 +70,9 @@
|
|||
<path stroke-linecap="round" stroke-linejoin="round" d="M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5m-9-6h.008v.008H12v-.008ZM12 15h.008v.008H12V15Zm0 2.25h.008v.008H12v-.008ZM9.75 15h.008v.008H9.75V15Zm0 2.25h.008v.008H9.75v-.008ZM7.5 15h.008v.008H7.5V15Zm0 2.25h.008v.008H7.5v-.008Zm6.75-4.5h.008v.008h-.008v-.008Zm0 2.25h.008v.008h-.008V15Zm0 2.25h.008v.008h-.008v-.008Zm2.25-4.5h.008v.008H16.5v-.008Zm0 2.25h.008v.008H16.5V15Z" />
|
||||
</svg>
|
||||
{{ playrange }}
|
||||
{% #popover id="popover-playrange" %}
|
||||
<c-popover id="popover-playrange">
|
||||
Earliest and latest dates played
|
||||
{% /popover %}
|
||||
</c-popover>
|
||||
</span>
|
||||
</div>
|
||||
<div class="inline-flex rounded-md shadow-sm mb-3" role="group">
|
||||
|
@ -90,15 +90,17 @@
|
|||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% #h1 badge=edition_count %}Editions{% /h1 %}
|
||||
<div class="mb-6">{% simple_table rows=edition_data.rows columns=edition_data.columns %}</div>
|
||||
<c-h1 :badge=edition_count>Editions</c-h1>
|
||||
<div class="mb-6">
|
||||
{% #h1 badge=purchase_count %}Purchases{% /h1 %}
|
||||
{% simple_table rows=purchase_data.rows columns=purchase_data.columns %}
|
||||
<c-simple-table :rows=edition_data.rows :columns=edition_data.columns />
|
||||
</div>
|
||||
<div class="mb-6">
|
||||
{% #h1 badge=session_count %}Sessions{% /h1 %}
|
||||
{% simple_table rows=session_data.rows columns=session_data.columns page_obj=session_page_obj elided_page_range=session_elided_page_range %}
|
||||
<c-h1 :badge=purchase_count>Purchases</c-h1>
|
||||
<c-simple-table :rows=purchase_data.rows :columns=purchase_data.columns />
|
||||
</div>
|
||||
<div class="mb-6">
|
||||
<c-h1 :badge=session_count>Sessions</c-h1>
|
||||
<c-simple-table :rows=session_data.rows :columns=session_data.columns :page_obj=session_page_obj :elided_page_range=session_elided_page_range />
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
from typing import Any
|
||||
|
||||
from django import template
|
||||
from django.http import QueryDict
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def param_replace(context: dict[Any, Any], **kwargs):
|
||||
"""
|
||||
Return encoded URL parameters that are the same as the current
|
||||
request's parameters, only with the specified GET parameters added or changed.
|
||||
"""
|
||||
d: QueryDict = context["request"].GET.copy()
|
||||
for k, v in kwargs.items():
|
||||
d[k] = v
|
||||
return d.urlencode()
|
|
@ -47,12 +47,13 @@ def list_devices(request: HttpRequest) -> HttpResponse:
|
|||
device.get_type_display(),
|
||||
device.created_at.strftime(dateformat),
|
||||
render_to_string(
|
||||
"components/button_group_sm.html",
|
||||
"cotton/button_group_sm.html",
|
||||
{
|
||||
"buttons": [
|
||||
{
|
||||
"href": reverse("edit_device", args=[device.pk]),
|
||||
"text": "Edit",
|
||||
"color": "gray",
|
||||
},
|
||||
{
|
||||
"href": reverse("delete_device", args=[device.pk]),
|
||||
|
|
|
@ -65,12 +65,13 @@ def list_editions(request: HttpRequest) -> HttpResponse:
|
|||
edition.wikidata,
|
||||
edition.created_at.strftime(dateformat),
|
||||
render_to_string(
|
||||
"components/button_group_sm.html",
|
||||
"cotton/button_group_sm.html",
|
||||
{
|
||||
"buttons": [
|
||||
{
|
||||
"href": reverse("edit_edition", args=[edition.pk]),
|
||||
"text": "Edit",
|
||||
"color": "gray",
|
||||
},
|
||||
{
|
||||
"href": reverse(
|
||||
|
|
|
@ -65,12 +65,13 @@ def list_games(request: HttpRequest) -> HttpResponse:
|
|||
game.wikidata,
|
||||
game.created_at.strftime(dateformat),
|
||||
render_to_string(
|
||||
"components/button_group_sm.html",
|
||||
"cotton/button_group_sm.html",
|
||||
{
|
||||
"buttons": [
|
||||
{
|
||||
"href": reverse("edit_game", args=[game.pk]),
|
||||
"text": "Edit",
|
||||
"color": "gray",
|
||||
},
|
||||
{
|
||||
"href": reverse("delete_game", args=[game.pk]),
|
||||
|
@ -193,12 +194,13 @@ def view_game(request: HttpRequest, game_id: int) -> HttpResponse:
|
|||
edition.platform,
|
||||
edition.year_released,
|
||||
render_to_string(
|
||||
"components/button_group_sm.html",
|
||||
"cotton/button_group_sm.html",
|
||||
{
|
||||
"buttons": [
|
||||
{
|
||||
"href": reverse("edit_edition", args=[edition.pk]),
|
||||
"text": "Edit",
|
||||
"color": "gray",
|
||||
},
|
||||
{
|
||||
"href": reverse("delete_edition", args=[edition.pk]),
|
||||
|
@ -221,12 +223,13 @@ def view_game(request: HttpRequest, game_id: int) -> HttpResponse:
|
|||
purchase.get_type_display(),
|
||||
f"{purchase.price} {purchase.price_currency}",
|
||||
render_to_string(
|
||||
"components/button_group_sm.html",
|
||||
"cotton/button_group_sm.html",
|
||||
{
|
||||
"buttons": [
|
||||
{
|
||||
"href": reverse("edit_purchase", args=[purchase.pk]),
|
||||
"text": "Edit",
|
||||
"color": "gray",
|
||||
},
|
||||
{
|
||||
"href": reverse("delete_purchase", args=[purchase.pk]),
|
||||
|
@ -266,12 +269,13 @@ def view_game(request: HttpRequest, game_id: int) -> HttpResponse:
|
|||
else "-"
|
||||
),
|
||||
render_to_string(
|
||||
"components/button_group_sm.html",
|
||||
"cotton/button_group_sm.html",
|
||||
{
|
||||
"buttons": [
|
||||
{
|
||||
"href": reverse("edit_session", args=[session.pk]),
|
||||
"text": "Edit",
|
||||
"color": "gray",
|
||||
},
|
||||
{
|
||||
"href": reverse("delete_session", args=[session.pk]),
|
||||
|
|
|
@ -47,7 +47,7 @@ def list_platforms(request: HttpRequest) -> HttpResponse:
|
|||
platform.group,
|
||||
platform.created_at.strftime(dateformat),
|
||||
render_to_string(
|
||||
"components/button_group_sm.html",
|
||||
"cotton/button_group_sm.html",
|
||||
{
|
||||
"buttons": [
|
||||
{
|
||||
|
@ -55,6 +55,7 @@ def list_platforms(request: HttpRequest) -> HttpResponse:
|
|||
"edit_platform", args=[platform.pk]
|
||||
),
|
||||
"text": "Edit",
|
||||
"color": "gray",
|
||||
},
|
||||
{
|
||||
"href": reverse(
|
||||
|
|
|
@ -80,7 +80,7 @@ def list_purchases(request: HttpRequest) -> HttpResponse:
|
|||
),
|
||||
purchase.created_at.strftime(dateformat),
|
||||
render_to_string(
|
||||
"components/button_group_sm.html",
|
||||
"cotton/button_group_sm.html",
|
||||
{
|
||||
"buttons": [
|
||||
{
|
||||
|
@ -88,6 +88,7 @@ def list_purchases(request: HttpRequest) -> HttpResponse:
|
|||
"edit_purchase", args=[purchase.pk]
|
||||
),
|
||||
"text": "Edit",
|
||||
"color": "gray",
|
||||
},
|
||||
{
|
||||
"href": reverse(
|
||||
|
|
|
@ -71,12 +71,13 @@ def list_sessions(request: HttpRequest) -> HttpResponse:
|
|||
session.device,
|
||||
session.created_at.strftime(dateformat),
|
||||
render_to_string(
|
||||
"components/button_group_sm.html",
|
||||
"cotton/button_group_sm.html",
|
||||
{
|
||||
"buttons": [
|
||||
{
|
||||
"href": reverse("edit_session", args=[session.pk]),
|
||||
"text": "Edit",
|
||||
"color": "gray",
|
||||
},
|
||||
{
|
||||
"href": reverse(
|
||||
|
|
|
@ -28,6 +28,27 @@ files = [
|
|||
[package.extras]
|
||||
tests = ["mypy (>=0.800)", "pytest", "pytest-asyncio"]
|
||||
|
||||
[[package]]
|
||||
name = "beautifulsoup4"
|
||||
version = "4.12.3"
|
||||
description = "Screen-scraping library"
|
||||
optional = false
|
||||
python-versions = ">=3.6.0"
|
||||
files = [
|
||||
{file = "beautifulsoup4-4.12.3-py3-none-any.whl", hash = "sha256:b80878c9f40111313e55da8ba20bdba06d8fa3969fc68304167741bbf9e082ed"},
|
||||
{file = "beautifulsoup4-4.12.3.tar.gz", hash = "sha256:74e3d1928edc070d21748185c46e3fb33490f22f52a3addee9aee0f4f7781051"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
soupsieve = ">1.2"
|
||||
|
||||
[package.extras]
|
||||
cchardet = ["cchardet"]
|
||||
chardet = ["chardet"]
|
||||
charset-normalizer = ["charset-normalizer"]
|
||||
html5lib = ["html5lib"]
|
||||
lxml = ["lxml"]
|
||||
|
||||
[[package]]
|
||||
name = "cfgv"
|
||||
version = "3.4.0"
|
||||
|
@ -110,6 +131,20 @@ tzdata = {version = "*", markers = "sys_platform == \"win32\""}
|
|||
argon2 = ["argon2-cffi (>=19.1.0)"]
|
||||
bcrypt = ["bcrypt"]
|
||||
|
||||
[[package]]
|
||||
name = "django-cotton"
|
||||
version = "0.9.34"
|
||||
description = "Bringing component based design to Django templates."
|
||||
optional = false
|
||||
python-versions = "<4,>=3.8"
|
||||
files = [
|
||||
{file = "django_cotton-0.9.34-py3-none-any.whl", hash = "sha256:9721dd79066d5a28eefb84527bea7f2daa8f1db6111ffdecbc5dd64fe2e300c9"},
|
||||
{file = "django_cotton-0.9.34.tar.gz", hash = "sha256:3f2d950a9ad0985955ca0fb2d5fbb42be1f07f55239864fe5a1d0e873303f0bd"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
beautifulsoup4 = ">=4.12.2,<4.13.0"
|
||||
|
||||
[[package]]
|
||||
name = "django-debug-toolbar"
|
||||
version = "4.4.6"
|
||||
|
@ -788,22 +823,16 @@ files = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "slippers"
|
||||
version = "0.6.2"
|
||||
description = "Build reusable components in Django without writing a single line of Python."
|
||||
name = "soupsieve"
|
||||
version = "2.6"
|
||||
description = "A modern CSS selector implementation for Beautiful Soup."
|
||||
optional = false
|
||||
python-versions = ">=3.8.0"
|
||||
python-versions = ">=3.8"
|
||||
files = [
|
||||
{file = "slippers-0.6.2-py3-none-any.whl", hash = "sha256:739e05f85354becbf0a65daab831eea62557d89e7512042209ab629af4378bca"},
|
||||
{file = "slippers-0.6.2.tar.gz", hash = "sha256:4cb555b8822ba0d404e5405723f5d723994022c29046008ee917081031bc0cf1"},
|
||||
{file = "soupsieve-2.6-py3-none-any.whl", hash = "sha256:e72c4ff06e4fb6e4b5a9f0f55fe6e81514581fca1515028625d0f299c602ccc9"},
|
||||
{file = "soupsieve-2.6.tar.gz", hash = "sha256:e2e68417777af359ec65daac1057404a3c8a5455bb8abc36f1a9866ab1a51abb"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
Django = ">=3.2"
|
||||
PyYAML = ">=5.4.0"
|
||||
typeguard = ">=2.13.3,<3.0.0"
|
||||
typing-extensions = ">=4.4.0"
|
||||
|
||||
[[package]]
|
||||
name = "sqlparse"
|
||||
version = "0.5.1"
|
||||
|
@ -850,21 +879,6 @@ notebook = ["ipywidgets (>=6)"]
|
|||
slack = ["slack-sdk"]
|
||||
telegram = ["requests"]
|
||||
|
||||
[[package]]
|
||||
name = "typeguard"
|
||||
version = "2.13.3"
|
||||
description = "Run-time type checker for Python"
|
||||
optional = false
|
||||
python-versions = ">=3.5.3"
|
||||
files = [
|
||||
{file = "typeguard-2.13.3-py3-none-any.whl", hash = "sha256:5e3e3be01e887e7eafae5af63d1f36c849aaa94e3a0112097312aabfa16284f1"},
|
||||
{file = "typeguard-2.13.3.tar.gz", hash = "sha256:00edaa8da3a133674796cf5ea87d9f4b4c367d77476e185e80251cc13dfbb8c4"},
|
||||
]
|
||||
|
||||
[package.extras]
|
||||
doc = ["sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"]
|
||||
test = ["mypy", "pytest", "typing-extensions"]
|
||||
|
||||
[[package]]
|
||||
name = "typing-extensions"
|
||||
version = "4.12.2"
|
||||
|
@ -928,4 +942,4 @@ test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess
|
|||
[metadata]
|
||||
lock-version = "2.0"
|
||||
python-versions = "^3.11"
|
||||
content-hash = "eb741020e400664070ed1eee24a17b6a9c07a2f2d44103e4947279aa26a40315"
|
||||
content-hash = "f96f55c381f25a4a473be8d53ef83d13c70bb7c731b5132f4ece2af1b3d3afed"
|
||||
|
|
|
@ -30,7 +30,7 @@ django-template-partials = "^24.2"
|
|||
markdown = "^3.6"
|
||||
|
||||
|
||||
slippers = "^0.6.2"
|
||||
django-cotton = "^0.9.34"
|
||||
[tool.isort]
|
||||
profile = "black"
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ INSTALLED_APPS = [
|
|||
"template_partials",
|
||||
"graphene_django",
|
||||
"django_htmx",
|
||||
"slippers",
|
||||
"django_cotton",
|
||||
]
|
||||
|
||||
GRAPHENE = {"SCHEMA": "games.schema.schema"}
|
||||
|
@ -87,7 +87,6 @@ TEMPLATES = [
|
|||
],
|
||||
"builtins": [
|
||||
"template_partials.templatetags.partials",
|
||||
"slippers.templatetags.slippers",
|
||||
],
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue