Vaihe 1/1: users-moduuli, kirjautuminen ja käyttäjähallinta
- shared-moduuli: DomainError, EmailAddress, UnitOfWork, tapahtumat, TimestampedModel, daisyUI-lomakerenderöinti ja yhteiset pohjat - users-moduuli Clean Architecture -kerroksin: oma käyttäjämalli (AUTH_USER_MODEL), roolit ja oikeudet, harjoittelija-, vastuuhenkilö- ja viimeisen pääkäyttäjän säännöt - kirjautuminen sähköpostilla, yritysten rajoitus, "muista minut", istunnon katkaisu kun tunnus poistetaan käytöstä tai harjoittelu päättyy - kertakäyttöiset salasanalinkit (72 h / 60 min, uusi mitätöi vanhan), salasanasääntö ja create_admin-komento - käyttäjähallinta: lista (HTMX-haku), lomakkeet ja kopioitava linkki - Tailwind 4 + daisyUI 5 + HTMX + Alpine npm-buildilla, suomennokset - testit: domain, application (fakeilla), integraatio ja selaintestit (axe, vaalea/tumma, 1920/320 px); ruff, mypy ja import-linter - dokumentit päivitetty toteutuksen mukaisiksi Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
{% load i18n %}
|
||||
{# Usage: include with id, title, body, action_url, confirm_label (and optional hx_target). #}
|
||||
<dialog id="{{ id }}" class="modal" aria-labelledby="{{ id }}-title">
|
||||
<div class="modal-box">
|
||||
<h2 id="{{ id }}-title" class="text-lg font-bold">{{ title }}</h2>
|
||||
<p class="py-4">{{ body }}</p>
|
||||
<div class="modal-action">
|
||||
<form method="dialog"><button class="btn">{% translate "Cancel" %}</button></form>
|
||||
<form method="post" action="{{ action_url }}"
|
||||
{% if hx_target %}hx-post="{{ action_url }}" hx-target="{{ hx_target }}" hx-swap="innerHTML"
|
||||
hx-on::after-request="this.closest('dialog').close()"{% endif %}>
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="btn btn-primary">{{ confirm_label }}</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</dialog>
|
||||
@@ -0,0 +1,23 @@
|
||||
{% load i18n %}{% with widget_type=field.widget_type %}
|
||||
<div class="fieldset {% if field.field.widget.input_type == 'hidden' %}hidden{% endif %}">
|
||||
{% if widget_type == "checkbox" %}
|
||||
<label class="label cursor-pointer justify-start gap-3 text-base-content" for="{{ field.auto_id }}">
|
||||
{{ field }}
|
||||
<span>{{ field.label }}</span>
|
||||
</label>
|
||||
{% else %}
|
||||
<label class="fieldset-legend text-sm" for="{{ field.auto_id }}">
|
||||
{{ field.label }}{% if field.field.required %} <span aria-hidden="true">*</span><span class="sr-only">{% translate "(required)" %}</span>{% endif %}
|
||||
</label>
|
||||
{{ field }}
|
||||
{% endif %}
|
||||
{% if field.help_text %}
|
||||
<p class="label text-sm whitespace-normal" id="{{ field.auto_id }}_helptext">{{ field.help_text }}</p>
|
||||
{% endif %}
|
||||
{% if field.errors %}
|
||||
<p class="text-error text-sm" id="{{ field.auto_id }}_error">
|
||||
{% for error in field.errors %}{{ error }}{% if not forloop.last %} {% endif %}{% endfor %}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endwith %}
|
||||
@@ -0,0 +1,3 @@
|
||||
{% include "components/non_field_errors.html" %}
|
||||
{% for field, errors in fields %}{{ field.as_field_group }}{% endfor %}
|
||||
{% for field in hidden_fields %}{{ field }}{% endfor %}
|
||||
@@ -0,0 +1,9 @@
|
||||
{% if messages %}
|
||||
<div class="space-y-2 mb-4" id="messages" tabindex="-1" data-autofocus>
|
||||
{% for message in messages %}
|
||||
<div role="status" class="alert {% if message.level_tag == 'error' %}alert-error{% elif message.level_tag == 'warning' %}alert-warning{% elif message.level_tag == 'success' %}alert-success{% else %}alert-info{% endif %} alert-soft">
|
||||
<span>{{ message }}</span>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
@@ -0,0 +1,5 @@
|
||||
{% if form.non_field_errors %}
|
||||
<div role="alert" class="alert alert-error alert-soft">
|
||||
<span>{% for error in form.non_field_errors %}{{ error }}{% if not forloop.last %} {% endif %}{% endfor %}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
@@ -0,0 +1,7 @@
|
||||
{% load i18n %}
|
||||
<div x-data="{ dark: document.documentElement.getAttribute('data-theme') === 'dark' || (!document.documentElement.getAttribute('data-theme') && window.matchMedia('(prefers-color-scheme: dark)').matches) }">
|
||||
<button type="button" class="btn btn-ghost btn-sm" :aria-pressed="dark.toString()"
|
||||
@click="dark = !dark; setTheme(dark ? 'dark' : 'light')">
|
||||
{% translate "Dark theme" %}
|
||||
</button>
|
||||
</div>
|
||||
Reference in New Issue
Block a user