styling of groups edit/add screens

This commit is contained in:
Dave Cranwell 2014-07-18 15:25:21 +01:00
parent 10037fd4cf
commit 4dd73a59f6
5 changed files with 102 additions and 63 deletions

View file

@ -8,23 +8,29 @@
{% trans "Add group" as add_group_str %}
{% include "wagtailadmin/shared/header.html" with title=add_group_str icon="group" %}
<form action="{% url 'wagtailusers_groups_create' %}" method="POST">
{% csrf_token %}
<div class="nice-padding">
<div class="nice-padding">
<form action="{% url 'wagtailusers_groups_create' %}" method="POST">
{% csrf_token %}
<ul class="fields">
{% include "wagtailadmin/shared/field_as_li.html" with field=form.name %}
{% format_permissions permission_bound_field=form.permissions %}
{% include "wagtailusers/groups/includes/page_permissions_formset.html" with formset=formset only %}
<li>
{% format_permissions permission_bound_field=form.permissions %}
</li>
<li>
{% include "wagtailusers/groups/includes/page_permissions_formset.html" with formset=formset only %}
</li>
<li><input type="submit" value='{% trans "Add group" %}' /></li>
</ul>
</div>
</form>
</form>
</div>
{% endblock %}
{% block extra_js %}
{% include "wagtailadmin/pages/_editor_js.html" %}
<script type="text/javascript">
<script>
{% include "wagtailusers/groups/includes/page_permissions_formset.js" with formset=formset only %}
</script>
{% endblock %}

View file

@ -8,27 +8,37 @@
{% trans "Editing" as editing_str %}
{% include "wagtailadmin/shared/header.html" with title=editing_str subtitle=group.name icon="group" %}
<form action="{% url 'wagtailusers_groups_edit' group.id %}" method="POST">
{% csrf_token %}
<div class="nice-padding">
<div class="nice-padding">
<form action="{% url 'wagtailusers_groups_edit' group.id %}" method="POST">
{% csrf_token %}
<ul class="fields">
{% include "wagtailadmin/shared/field_as_li.html" with field=form.name %}
{% format_permissions permission_bound_field=form.permissions %}
{% include "wagtailusers/groups/includes/page_permissions_formset.html" with formset=formset only %}
<li><input type="submit" value="{% trans 'Save' %}" />
{% if perms.auth.delete_group %}
<a href="{% url 'wagtailusers_groups_delete' group.id %}" class="button button-secondary no">{% trans "Delete group" %}</a>
{% endif %}
<li>
{% format_permissions permission_bound_field=form.permissions %}
</li>
<li>
{% include "wagtailusers/groups/includes/page_permissions_formset.html" with formset=formset only %}
</li>
<li>
<input type="submit" value="{% trans 'Save' %}" />
{% if perms.auth.delete_group %}
<a href="{% url 'wagtailusers_groups_delete' group.id %}" class="button button-secondary no">{% trans "Delete group" %}</a>
{% endif %}
</li>
</ul>
</div>
</form>
</form>
</div>
{% endblock %}
{% block extra_js %}
{% include "wagtailadmin/pages/_editor_js.html" %}
<script type="text/javascript">
<script>
{% include "wagtailusers/groups/includes/page_permissions_formset.js" with formset=formset only %}
</script>
{% endblock %}

View file

@ -1,42 +1,63 @@
<h3>Object permissions</h3>
{% load i18n %}
<h2>{% trans "Object permissions" %}</h2>
<table class="listing">
<tr>
<th>Object</th>
<th>Add</th>
<th>Change</th>
<th>Delete</th>
</tr>
{% for content_perms_dict in object_perms %}
<tr>
<td>{{ content_perms_dict.object|capfirst }}</td>
<td>
{% with content_perms_dict.add as perm_tuple %}
<input id="id_permissions_{{ perm_tuple.0.id }}" name="permissions" type="checkbox" {{ perm_tuple.1 }} value="{{ perm_tuple.0.id }}">
{% endwith %}
</td>
<td>
{% with content_perms_dict.change as perm_tuple %}
<input id="id_permissions_{{ perm_tuple.0.id }}" name="permissions" type="checkbox" {{ perm_tuple.1 }} value="{{ perm_tuple.0.id }}">
{% endwith %}
</td>
<td>
{% with content_perms_dict.delete as perm_tuple %}
<input id="id_permissions_{{ perm_tuple.0.id }}" name="permissions" type="checkbox" {{ perm_tuple.1 }} value="{{ perm_tuple.0.id }}">
{% endwith %}
</td>
</tr>
{% endfor %}
</table>
<h3>Other permissions</h3>
<table class="listing">
{% for perm_tuple in other_perms %}
<tr>
<td>{{ perm_tuple.0.name }}</td>
<td>
<label for="id_permissions_{{ perm_tuple.0.id }}">
<col />
<col width="15%" />
<col width="15%" />
<col width="15%" />
<thead>
<tr>
<th>{% trans "Name" %}</th>
<th>{% trans "Add" %}</th>
<th>{% trans "Change" %}</th>
<th>{% trans "Delete" %}</th>
</tr>
</thead>
<tbody>
{% for content_perms_dict in object_perms %}
<tr>
<td class="title"><h3>{{ content_perms_dict.object|capfirst }}</h3></td>
<td>
{% with content_perms_dict.add as perm_tuple %}
<input id="id_permissions_{{ perm_tuple.0.id }}" name="permissions" type="checkbox" {{ perm_tuple.1 }} value="{{ perm_tuple.0.id }}">
</label>
</td>
</tr>
{% endfor %}
{% endwith %}
</td>
<td>
{% with content_perms_dict.change as perm_tuple %}
<input id="id_permissions_{{ perm_tuple.0.id }}" name="permissions" type="checkbox" {{ perm_tuple.1 }} value="{{ perm_tuple.0.id }}">
{% endwith %}
</td>
<td>
{% with content_perms_dict.delete as perm_tuple %}
<input id="id_permissions_{{ perm_tuple.0.id }}" name="permissions" type="checkbox" {{ perm_tuple.1 }} value="{{ perm_tuple.0.id }}">
{% endwith %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
<h2>{% trans "Other permissions" %}</h2>
<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>{{ perm_tuple.0.name }}</td>
<td>
<label for="id_permissions_{{ perm_tuple.0.id }}">
<input id="id_permissions_{{ perm_tuple.0.id }}" name="permissions" type="checkbox" {{ perm_tuple.1 }} value="{{ perm_tuple.0.id }}">
</label>
</td>
</tr>
{% endfor %}
</tbody>
</table>

View file

@ -1,5 +1,8 @@
{% load i18n %}
{{ formset.management_form }}
<h2>Page permissions</h2>
{{ formset.management_form }}{# what is this? #}
<ul class="multiple" id="id_{{ formset.prefix }}-FORMS">
{% for form in formset.forms %}
{% include "wagtailusers/groups/includes/page_permissions_form.html" with form=form only %}

View file

@ -17,7 +17,6 @@
<tr>
<td class="title">
<h2>
<span class="avatar small icon icon-group"></span>
<a href="{% url 'wagtailusers_groups_edit' group.id %}">{{ group.name }}</a>
</h2>
</td>