Files
ACORE/templates/admin/group_access_matrix.html
T
lokses 7074244479 admin: полная матрица доступа групп в админке
Кнопка «Матрица доступа» на списке групп (unfold actions_list) открывает
сетку: строки — разделы портала, колонки — все группы, галочки просмотра.
Сохранение через apply_full_access_matrix (CUD не трогает — они на карточке
группы). Логика переиспользована из user_groups_portal. Смоук-тесты рендера
и сохранения.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-09-21 15:33:25 +03:00

52 lines
2.3 KiB
HTML

{% extends "admin/base_site.html" %}
{% load i18n %}
{% block content %}
<div style="margin-bottom:1rem;">
<p style="color:var(--color-base-500);font-size:0.85rem;">
{% trans "Строки — разделы портала, колонки — группы доступа. Галочка = доступ на просмотр раздела. Детальные права (создание/изменение/удаление) настраиваются на карточке конкретной группы." %}
</p>
</div>
<form method="post">
{% csrf_token %}
<div style="overflow-x:auto;border:1px solid var(--color-base-200);border-radius:0.5rem;">
<table style="border-collapse:collapse;width:100%;font-size:0.85rem;">
<thead>
<tr>
<th style="position:sticky;left:0;background:var(--color-base-100);text-align:left;padding:0.5rem 0.75rem;border-bottom:1px solid var(--color-base-200);z-index:2;">
{% trans "Раздел" %}
</th>
{% for g in groups %}
<th style="padding:0.5rem 0.5rem;border-bottom:1px solid var(--color-base-200);white-space:nowrap;text-align:center;">
{{ g.name }}
</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for row in rows %}
<tr>
<td style="position:sticky;left:0;background:var(--color-base-50);padding:0.4rem 0.75rem;border-bottom:1px solid var(--color-base-100);white-space:nowrap;font-weight:500;z-index:1;">
{{ row.label }}
</td>
{% for cell in row.cells %}
<td style="text-align:center;padding:0.3rem;border-bottom:1px solid var(--color-base-100);">
<input type="checkbox" name="g{{ cell.group_id }}_{{ row.key }}"{% if cell.checked %} checked{% endif %}>
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div style="margin-top:1rem;display:flex;gap:0.75rem;align-items:center;">
<button type="submit" class="button" style="background:var(--color-primary-600);color:#fff;padding:0.5rem 1.25rem;border:none;border-radius:0.375rem;cursor:pointer;">
{% trans "Сохранить" %}
</button>
<a href="{% url 'admin:auth_group_changelist' %}" style="color:var(--color-base-500);">{% trans "Назад к группам" %}</a>
</div>
</form>
{% endblock %}