Initial commit

This commit is contained in:
2024-08-27 20:33:44 +02:00
commit 1f1832267d
14794 changed files with 1599592 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
{% extends "wagtailadmin/generic/confirm_delete.html" %}
{% load i18n %}
{% block main_content %}
<p>
{% blocktrans trimmed with group_name=group.name count group_user_count=group.user_set.count %}
The group '{{ group_name }}' has <strong>{{ group_user_count }}</strong> member.
{% plural %}
The group '{{ group_name }}' has <strong>{{ group_user_count }}</strong> members.
{% endblocktrans %}
</p>
<p>
{% if group.user_set.count %}
{% trans "Deleting this group will revoke this group's permissions from all member users." %}
{% endif %}
</p>
<p>{% trans "Are you sure you want to delete this group?" %}</p>
<form action="{% url 'wagtailusers_groups:delete' group.id %}" method="POST">
{% csrf_token %}
<input type="submit" value="{% trans 'Yes, delete' %}" class="button serious" />
</form>
{% endblock %}

View File

@@ -0,0 +1,29 @@
{% extends "wagtailadmin/generic/create.html" %}
{% load wagtailusers_tags i18n wagtailadmin_tags %}
{% block main_content %}
<form action="{% url 'wagtailusers_groups:add' %}" method="POST" novalidate>
{% csrf_token %}
<ul class="fields">
{% block fields %}
<li>{% formattedfield form.name %}</li>
{% block extra_fields %}{% endblock extra_fields %}
{% endblock fields %}
<li>
{% format_permissions permission_bound_field=form.permissions %}
</li>
{% for panel in permission_panels %}
<li>
{{ panel.as_admin_panel }}
</li>
{% endfor %}
<li><input type="submit" value="{% trans 'Add group' %}" class="button" /></li>
</ul>
</form>
{% endblock %}
{% block extra_js %}
{{ block.super }}
{% include "wagtailusers/groups/includes/group_form_js.html" %}
{% endblock %}

View File

@@ -0,0 +1,40 @@
{% extends "wagtailadmin/generic/edit.html" %}
{% load wagtailusers_tags wagtailadmin_tags i18n %}
{% block main_content %}
<form action="{% url 'wagtailusers_groups:edit' group.id %}" method="POST" novalidate>
{% csrf_token %}
<div class="fields">
{% block fields %}
{% panel id="name" heading=form.name.label id_for_label=form.name.id_for_label is_required=True %}
{% formattedfield field=form.name show_label=False %}
{% endpanel %}
{% block extra_fields %}{% endblock extra_fields %}
{% endblock fields %}
<div>
{% format_permissions permission_bound_field=form.permissions %}
</div>
{% for panel in permission_panels %}
<div>
{{ panel.as_admin_panel }}
</div>
{% endfor %}
<div>
<input type="submit" value="{% trans 'Save' %}" class="button" />
{% if perms.auth.delete_group %}
<a href="{% url 'wagtailusers_groups:delete' group.id %}" class="button no">{% trans "Delete group" %}</a>
{% endif %}
</div>
</div>
</form>
{% endblock %}
{% block extra_js %}
{{ block.super }}
{% include "wagtailusers/groups/includes/group_form_js.html" %}
{% endblock %}

View File

@@ -0,0 +1,183 @@
{% load i18n wagtailadmin_tags %}
{% trans "Object permissions" as heading %}
{% panel id="object-permissions" heading=heading %}
<fieldset>
<legend class="w-sr-only">{% trans "Object permissions" %}</legend>
<table class="listing" data-controller="w-bulk">
<colgroup>
<col />
<col width="10%" />
<col width="10%" />
<col width="10%" />
{% if extra_perms_exist.publish %}
<col width="10%" />
{% endif %}
{% if extra_perms_exist.lock %}
<col width="10%" />
{% endif %}
{% if extra_perms_exist.unlock %}
<col width="10%" />
{% endif %}
{% if extra_perms_exist.custom %}
<col width="25%" />
{% endif %}
</colgroup>
<thead>
<tr>
<th>{% trans "Name" %}</th>
<th>{% trans "Add" %}</th>
<th>{% trans "Change" %}</th>
<th>{% trans "Delete" %}</th>
{% if extra_perms_exist.publish %}
<th>{% trans "Publish" %}</th>
{% endif %}
{% if extra_perms_exist.lock %}
<th>{% trans "Lock" %}</th>
{% endif %}
{% if extra_perms_exist.unlock %}
<th>{% trans "Unlock" %}</th>
{% endif %}
{% if extra_perms_exist.custom %}
<th>{% trans "Custom permissions" %}</th>
{% endif %}
</tr>
</thead>
<tbody>
{% for content_perms_dict in object_perms %}
<tr>
<td class="title"><h3>{{ content_perms_dict.object|capfirst }}</h3></td>
<td>
{% if content_perms_dict.add %}
<label for="{{ content_perms_dict.add.checkbox.id_for_label }}" class="w-sr-only">{{ content_perms_dict.add.perm.name }}</label>
{{ content_perms_dict.add.checkbox.tag }}
{% endif %}
</td>
<td>
{% if content_perms_dict.change %}
<label for="{{ content_perms_dict.change.checkbox.id_for_label }}" class="w-sr-only">{{ content_perms_dict.change.perm.name }}</label>
{{ content_perms_dict.change.checkbox.tag }}
{% endif %}
</td>
<td>
{% if content_perms_dict.delete %}
<label for="{{ content_perms_dict.delete.checkbox.id_for_label }}" class="w-sr-only">{{ content_perms_dict.delete.perm.name }}</label>
{{ content_perms_dict.delete.checkbox.tag }}
{% endif %}
</td>
{% if extra_perms_exist.publish %}
<td>
{% if content_perms_dict.publish %}
<label for="{{ content_perms_dict.publish.checkbox.id_for_label }}" class="w-sr-only">{{ content_perms_dict.publish.perm.name }}</label>
{{ content_perms_dict.publish.checkbox.tag }}
{% endif %}
</td>
{% endif %}
{% if extra_perms_exist.lock %}
<td>
{% if content_perms_dict.lock %}
<label for="{{ content_perms_dict.lock.checkbox.id_for_label }}" class="w-sr-only">{{ content_perms_dict.lock.perm.name }}</label>
{{ content_perms_dict.lock.checkbox.tag }}
{% endif %}
</td>
{% endif %}
{% if extra_perms_exist.unlock %}
<td>
{% if content_perms_dict.unlock %}
<label for="{{ content_perms_dict.unlock.checkbox.id_for_label }}" class="w-sr-only">{{ content_perms_dict.unlock.perm.name }}</label>
{{ content_perms_dict.unlock.checkbox.tag }}
{% endif %}
</td>
{% endif %}
{% if extra_perms_exist.custom %}
<td>
{% if content_perms_dict.custom %}
<fieldset class="w-p-0">
<legend class="w-sr-only">{% trans "Custom permissions" %}</legend>
{% for custom_perm in content_perms_dict.custom %}
{% trans custom_perm.name as custom_perm_label %}
{% include "wagtailadmin/shared/forms/single_checkbox.html" with name="permissions" value=custom_perm.perm.id checked=custom_perm.selected text=custom_perm_label attrs=custom_perm.attrs %}
{% endfor %}
</fieldset>
{% endif %}
</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<th scope="row">
<input id="toggle-all" type="checkbox" data-action="w-bulk#toggleAll" data-w-bulk-target="all">
<label for="toggle-all" >{% trans "Toggle all" %}</label>
</th>
<td>
<label for="toggle-all-add" class="visuallyhidden">{% trans "Toggle all add permissions" %}</label>
<input id="toggle-all-add" type="checkbox" data-action="w-bulk#toggleAll" data-w-bulk-target="all" data-w-bulk-group-param="add">
</td>
<td>
<label for="toggle-all-change" class="visuallyhidden">{% trans "Toggle all change permissions" %}</label>
<input id="toggle-all-change" type="checkbox" data-action="w-bulk#toggleAll" data-w-bulk-target="all" data-w-bulk-group-param="change">
</td>
<td>
<label for="toggle-all-delete" class="visuallyhidden">{% trans "Toggle all delete permissions" %}</label>
<input id="toggle-all-delete" type="checkbox" data-action="w-bulk#toggleAll" data-w-bulk-target="all" data-w-bulk-group-param="delete">
</td>
{% if extra_perms_exist.publish %}
<td>
<label for="toggle-all-publish" class="visuallyhidden">{% trans "Toggle all publish permissions" %}</label>
<input id="toggle-all-publish" type="checkbox" data-action="w-bulk#toggleAll" data-w-bulk-target="all" data-w-bulk-group-param="publish">
</td>
{% endif %}
{% if extra_perms_exist.lock %}
<td>
<label for="toggle-all-lock" class="visuallyhidden">{% trans "Toggle all lock permissions" %}</label>
<input id="toggle-all-lock" type="checkbox" data-action="w-bulk#toggleAll" data-w-bulk-target="all" data-w-bulk-group-param="lock">
</td>
{% endif %}
{% if extra_perms_exist.unlock %}
<td>
<label for="toggle-all-unlock" class="visuallyhidden">{% trans "Toggle all unlock permissions" %}</label>
<input id="toggle-all-unlock" type="checkbox" data-action="w-bulk#toggleAll" data-w-bulk-target="all" data-w-bulk-group-param="unlock">
</td>
{% endif %}
{% if extra_perms_exist.custom %}
<td>
<label for="toggle-all-custom" class="visuallyhidden">{% trans "Toggle all custom permissions" %}</label>
<input id="toggle-all-custom" type="checkbox" data-action="w-bulk#toggleAll" data-w-bulk-target="all" data-w-bulk-group-param="custom">
</td>
{% endif %}
</tr>
</tfoot>
</table>
</fieldset>
{% endpanel %}
{% trans "Other permissions" as heading %}
{% panel id="other-permissions" heading=heading %}
<fieldset>
<legend class="w-sr-only">{% trans "Other permissions" %}</legend>
<table class="listing">
<col />
<col width="45%" />
<thead>
<tr>
<th>{% trans "Name" %}</th>
<th></th>
</tr>
</thead>
<tbody>
{% for perm_tuple in other_perms %}
<tr>
<td class="title"><label for="{{ perm_tuple.1.id_for_label }}" class="w-label-3">{% trans perm_tuple.0.name %}</label></td>
<td>
{{ perm_tuple.1.tag }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</fieldset>
{% endpanel %}

View File

@@ -0,0 +1,3 @@
{% load wagtailadmin_tags %}
<script src="{% versioned_static 'wagtailadmin/js/expanding-formset.js' %}"></script>
<script src="{% versioned_static 'wagtailusers/js/group-form.js' %}"></script>

View File

@@ -0,0 +1,14 @@
{% load i18n wagtailadmin_tags %}
<td>
{% formattedfield field=form.page sr_only_label=True %}
{{ form.DELETE }}
</td>
{% for option in form.permissions %}
<td><label for="{{ option.id_for_label }}" class="w-sr-only">{{ option.choice_label }}</label>{{ option.tag }}</td>
{% endfor %}
<td>
<button class="button button-small no" type="button" id="{{ form.DELETE.id_for_label }}-button">{% trans "Delete" %}</button>
</td>

View File

@@ -0,0 +1,57 @@
{% load i18n wagtailadmin_tags %}
{% trans "Page permissions" as heading %}
{% panel id="page-permissions" heading=heading icon="folder-open-inverse" %}
{{ formset.management_form }}
{% if formset.non_form_errors %}
<p class="error-message">
{% for error in formset.non_form_errors %}
<span>{{ error }}</span>
{% endfor %}
</p>
{% endif %}
<table class="listing">
<col />
{% for i in formset.permission_types %}
<col width="15%" />
{% endfor %}
<col />
<thead>
<tr>
<th>{% trans "Page" %}</th>
{% for identifier, short_label, long_label in formset.permission_types %}
<th title="{{ long_label }}">{{ short_label }}</th>
{% endfor %}
<th></th>
</tr>
</thead>
<tbody id="id_{{ formset.prefix }}-FORMS">
{% for form in formset.forms %}
<tr id="inline_child_{{ form.prefix }}"{% if form.DELETE.value %} style="display: none;"{% endif %}>
{% if form.non_field_errors %}
<p class="error-message">
{% for error in form.non_field_errors %}
<span>{{ error|escape }}</span>
{% endfor %}
</p>
{% endif %}
{% include "wagtailusers/groups/includes/page_permissions_form.html" with form=form only %}
</tr>
{% endfor %}
</tbody>
</table>
<template id="id_{{ formset.prefix }}-EMPTY_FORM_TEMPLATE">
<tr id="inline_child_{{ formset.empty_form.prefix }}">
{% include "wagtailusers/groups/includes/page_permissions_form.html" with form=formset.empty_form only %}
</tr>
</template>
<p class="add">
<button class="button bicolor button--icon" id="id_{{ formset.prefix }}-ADD" value="Add" type="button">{% icon name="plus" wrapped=1 %}{% trans "Add a page permission" %}</button>
</p>
{% endpanel %}

View File

@@ -0,0 +1 @@
{% extends "wagtailadmin/generic/index.html" %}

View File

@@ -0,0 +1,10 @@
{% extends "wagtailadmin/generic/listing_results.html" %}
{% load i18n %}
{% block no_results_message %}
{% if is_searching %}
<p role="alert">{% blocktrans trimmed with query=search_form.q.value %}Sorry, no groups match "{{ query }}"{% endblocktrans %}</p>
{% else %}
<p>{% blocktrans trimmed with wagtailusers_create_group_url=add_url %}There are no groups configured. Why not <a href="{{ wagtailusers_create_group_url }}">add some</a>?{% endblocktrans %}</p>
{% endif %}
{% endblock %}