kopia lustrzana https://github.com/wagtail/wagtail
Simplify group create/edit templates
This also introduces the footer actions and unsaved changes warning to these views.pull/12425/head
rodzic
fc05b3eb59
commit
6fef75376e
|
@ -1,26 +1,28 @@
|
||||||
{% extends "wagtailadmin/generic/create.html" %}
|
{% extends "wagtailadmin/generic/create.html" %}
|
||||||
{% load wagtailusers_tags i18n wagtailadmin_tags %}
|
{% load wagtailusers_tags i18n wagtailadmin_tags %}
|
||||||
|
|
||||||
{% block main_content %}
|
{% block form_content %}
|
||||||
<form action="{% url 'wagtailusers_groups:add' %}" method="POST" novalidate>
|
{% block fields %}
|
||||||
{% csrf_token %}
|
{% comment %}
|
||||||
|
This block is not documented, but developers might assume its existence
|
||||||
|
based on the docs for custom user forms.
|
||||||
|
{% endcomment %}
|
||||||
|
|
||||||
|
{% 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 %}
|
||||||
|
|
||||||
|
<div class="w-form-width">
|
||||||
|
{# This block is documented in the docs for customizing group views #}
|
||||||
|
{% block extra_fields %}{% endblock extra_fields %}
|
||||||
|
|
||||||
|
{% format_permissions permission_bound_field=form.permissions %}
|
||||||
|
|
||||||
<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 %}
|
{% for panel in permission_panels %}
|
||||||
<li>
|
{{ panel.as_admin_panel }}
|
||||||
{{ panel.as_admin_panel }}
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<li><input type="submit" value="{% trans 'Add group' %}" class="button" /></li>
|
</div>
|
||||||
</ul>
|
{% endblock %}
|
||||||
</form>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block extra_js %}
|
{% block extra_js %}
|
||||||
|
|
|
@ -1,40 +1,2 @@
|
||||||
{% extends "wagtailadmin/generic/edit.html" %}
|
{% extends "wagtailusers/groups/create.html" %}
|
||||||
{% load wagtailusers_tags wagtailadmin_tags i18n %}
|
{# The built-in templates are now identical. #}
|
||||||
|
|
||||||
{% 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 %}
|
|
||||||
|
|
Ładowanie…
Reference in New Issue