mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-04-23 17:18:44 +02:00
feat: guess what, more changes
This commit is contained in:
@@ -1,16 +1,13 @@
|
||||
{% load hijack %}
|
||||
{% load i18n %}
|
||||
<c-ui.fab-single-action
|
||||
url="{% url 'user_add' %}"
|
||||
hx_target="#generic-offcanvas">
|
||||
</c-ui.fab-single-action>
|
||||
<div class="container px-md-3 py-3 column-gap-5">
|
||||
<div class="text-3xl font-bold font-mono w-full mb-3">
|
||||
{% spaceless %}
|
||||
<div>{% translate 'Users' %}<span>
|
||||
<a class="no-underline text-2xl p-1 category-action"
|
||||
role="button"
|
||||
data-tippy-content="{% translate "Add" %}"
|
||||
hx-get="{% url 'user_add' %}"
|
||||
hx-target="#generic-offcanvas">
|
||||
<i class="fa-solid fa-circle-plus fa-fw"></i></a>
|
||||
</span></div>
|
||||
<div>{% translate 'Users' %}</div>
|
||||
{% endspaceless %}
|
||||
</div>
|
||||
|
||||
@@ -20,58 +17,60 @@
|
||||
{% if users %}
|
||||
<div class="overflow-x-auto">
|
||||
<c-config.search></c-config.search>
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="table-col-auto"></th>
|
||||
<th scope="col">{% translate 'Active' %}</th>
|
||||
<th scope="col">{% translate 'Name' %}</th>
|
||||
<th scope="col">{% translate 'Email' %}</th>
|
||||
<th scope="col">{% translate 'Superuser' %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for user in users %}
|
||||
<tr class="tag">
|
||||
<td class="table-col-auto">
|
||||
<div class="join" role="group" aria-label="{% translate 'Actions' %}">
|
||||
<a class="btn btn-secondary btn-sm join-item"
|
||||
role="button"
|
||||
hx-swap="innerHTML"
|
||||
data-tippy-content="{% translate "Edit" %}"
|
||||
hx-get="{% url 'user_edit' pk=user.id %}"
|
||||
hx-target="#generic-offcanvas">
|
||||
<i class="fa-solid fa-pencil fa-fw"></i></a>
|
||||
{% if request.user|can_hijack:user and request.user != user %}
|
||||
<a class="btn btn-info btn-sm join-item"
|
||||
<div class="overflow-x-auto">
|
||||
<table class="table table-zebra">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="table-col-auto"></th>
|
||||
<th scope="col">{% translate 'Active' %}</th>
|
||||
<th scope="col">{% translate 'Name' %}</th>
|
||||
<th scope="col">{% translate 'Email' %}</th>
|
||||
<th scope="col">{% translate 'Superuser' %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for user in users %}
|
||||
<tr class="tag">
|
||||
<td class="table-col-auto">
|
||||
<div class="join" role="group" aria-label="{% translate 'Actions' %}">
|
||||
<a class="btn btn-secondary btn-sm join-item"
|
||||
role="button"
|
||||
data-tippy-content="{% translate "Impersonate" %}"
|
||||
hx-post="{% url 'hijack:acquire' %}"
|
||||
hx-vals='{"user_pk":"{{user.id}}"}'
|
||||
hx-swap="none"
|
||||
_="on htmx:afterRequest(event) from me
|
||||
hx-swap="innerHTML"
|
||||
data-tippy-content="{% translate "Edit" %}"
|
||||
hx-get="{% url 'user_edit' pk=user.id %}"
|
||||
hx-target="#generic-offcanvas">
|
||||
<i class="fa-solid fa-pencil fa-fw"></i></a>
|
||||
{% if request.user|can_hijack:user and request.user != user %}
|
||||
<a class="btn btn-info btn-sm join-item"
|
||||
role="button"
|
||||
data-tippy-content="{% translate "Impersonate" %}"
|
||||
hx-post="{% url 'hijack:acquire' %}"
|
||||
hx-vals='{"user_pk":"{{ user.id }}"}'
|
||||
hx-swap="none"
|
||||
_="on htmx:afterRequest(event) from me
|
||||
if event.detail.successful
|
||||
go to url '/'">
|
||||
<i class="fa-solid fa-mask fa-fw"></i></a>
|
||||
<i class="fa-solid fa-mask fa-fw"></i></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{% if user.is_active %}
|
||||
<i class="fa-solid fa-solid fa-check text-success"></i>
|
||||
{% endif %}
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{% if user.is_active %}
|
||||
<i class="fa-solid fa-solid fa-check text-success"></i>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ user.first_name }} {{ user.last_name }}</td>
|
||||
<td>{{ user.email }}</td>
|
||||
<td>
|
||||
{% if user.is_superuser %}
|
||||
<i class="fa-solid fa-solid fa-check text-success"></i>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
<td>{{ user.first_name }} {{ user.last_name }}</td>
|
||||
<td>{{ user.email }}</td>
|
||||
<td>
|
||||
{% if user.is_superuser %}
|
||||
<i class="fa-solid fa-solid fa-check text-success"></i>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<c-msg.empty title="{% translate "No users" %}" remove-padding></c-msg.empty>
|
||||
|
||||
@@ -9,41 +9,46 @@
|
||||
{% block content %}
|
||||
<div class="min-h-screen flex items-center justify-center p-4">
|
||||
<div class="w-full max-w-md">
|
||||
{% settings "DEMO" as demo_mode %}
|
||||
{% if demo_mode %}
|
||||
<div class="card bg-base-100 shadow-xl mb-3">
|
||||
<div class="card-body">
|
||||
<h1 class="text-lg card-title text-center mb-4">{% trans "Welcome to WYGIWYH's demo!" %}</h1>
|
||||
<p>{% trans 'Use the credentials below to login' %}:</p>
|
||||
<p>{% trans 'E-mail' %}: <span class="badge badge-secondary select-all">demo@demo.com</span></p>
|
||||
<p>{% trans 'Password' %}: <span class="badge badge-secondary select-all">wygiwyhdemo</span></p>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="card bg-base-100 shadow-2xl">
|
||||
<div class="card-body">
|
||||
<h1 class="text-2xl card-title text-center mb-4">Login</h1>
|
||||
{% crispy form %}
|
||||
|
||||
{% get_providers as socialaccount_providers %}
|
||||
{% if socialaccount_providers %}
|
||||
<div class="mt-3">
|
||||
<hr class="hr">
|
||||
<ul class="socialaccount_providers list-none">
|
||||
{% for provider in socialaccount_providers %}
|
||||
<li class="mt-2">
|
||||
<a title="{{ provider.name }}"
|
||||
class="btn btn-outline btn-primary w-full socialaccount_provider {{ provider.id }}"
|
||||
href="{% provider_login_url provider %}">
|
||||
{% translate 'Login with' %} {{ provider.name }}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% settings "DEMO" as demo_mode %}
|
||||
{% if demo_mode %}
|
||||
<div class="card bg-base-100 shadow-xl mb-3">
|
||||
<div class="card-body">
|
||||
<h1 class="text-lg card-title text-center mb-4">{% trans "Welcome to WYGIWYH's demo!" %}</h1>
|
||||
<p>{% trans 'Use the credentials below to login' %}:</p>
|
||||
<p>{% trans 'E-mail' %}: <span class="badge badge-secondary select-all">demo@demo.com</span></p>
|
||||
<p>{% trans 'Password' %}: <span class="badge badge-secondary select-all">wygiwyhdemo</span></p>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="card bg-base-100 shadow-2xl">
|
||||
<div class="card-body">
|
||||
<h1 class="text-2xl card-title text-center mb-4">Login</h1>
|
||||
{% crispy form %}
|
||||
|
||||
{% get_providers as socialaccount_providers %}
|
||||
{% if socialaccount_providers %}
|
||||
<hr class="hr my-3">
|
||||
<ul class="socialaccount_providers list-none flex flex-col gap-3">
|
||||
{% for provider in socialaccount_providers %}
|
||||
<li>
|
||||
<a title="{{ provider.name }}"
|
||||
class="btn btn-outline btn-primary w-full socialaccount_provider {{ provider.id }}"
|
||||
href="{% provider_login_url provider %}">
|
||||
{% translate 'Login with' %} {{ provider.name }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a title="{{ provider.name }}"
|
||||
class="btn btn-outline btn-primary w-full socialaccount_provider {{ provider.id }}"
|
||||
href="{% provider_login_url provider %}">
|
||||
{% translate 'Login with' %} {{ provider.name }}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user