mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-10 16:24:49 +00:00
styled list of page permissions to more resemble other permissions above
This commit is contained in:
parent
4dd73a59f6
commit
b310fcad01
6 changed files with 80 additions and 45 deletions
|
|
@ -944,9 +944,9 @@ class PageRevision(models.Model):
|
|||
|
||||
|
||||
PAGE_PERMISSION_TYPE_CHOICES = [
|
||||
('add', 'Add'),
|
||||
('edit', 'Edit'),
|
||||
('publish', 'Publish'),
|
||||
('add', 'Add / edit pages you own'),
|
||||
('edit', 'Add / edit any page'),
|
||||
('publish', 'Publish pages'),
|
||||
]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
.listing {
|
||||
.field label{
|
||||
display:none;
|
||||
}
|
||||
input,select,textarea{
|
||||
font-size:1em;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2,8 +2,16 @@
|
|||
{% load image_tags %}
|
||||
{% load wagtailusers_tags %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block titletag %}{% trans "Add group" %}{% endblock %}
|
||||
{% block bodyclass %}menu-groups{% endblock %}
|
||||
|
||||
{% block extra_css %}
|
||||
{% compress css %}
|
||||
<link rel="stylesheet" href="{{ STATIC_URL }}wagtailusers/scss/groups_edit.scss" type="text/x-scss" />
|
||||
{% endcompress %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% trans "Add group" as add_group_str %}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,17 @@
|
|||
{% load image_tags %}
|
||||
{% load wagtailusers_tags %}
|
||||
{% load i18n %}
|
||||
{% load compress %}
|
||||
|
||||
{% block titletag %}{% trans "Editing" %} {{ group.name }}{% endblock %}
|
||||
{% block bodyclass %}menu-groups{% endblock %}
|
||||
|
||||
{% block extra_css %}
|
||||
{% compress css %}
|
||||
<link rel="stylesheet" href="{{ STATIC_URL }}wagtailusers/scss/groups_edit.scss" type="text/x-scss" />
|
||||
{% endcompress %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% trans "Editing" as editing_str %}
|
||||
|
|
@ -12,7 +21,7 @@
|
|||
<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 %}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,38 +1,24 @@
|
|||
{% load i18n %}
|
||||
{% comment %}
|
||||
TODO - DRY this form with /wagtailsearch/templates/wagtailsearch/editorspicks/includes/editorspicks_form.html
|
||||
{% endcomment %}
|
||||
<li id="inline_child_{{ form.prefix }}"{% if form.DELETE.value %} style="display: none;"{% endif %}>
|
||||
<ul class="controls">
|
||||
<li class="icon text-replace icon-bin" id="{{ form.DELETE.id_for_label }}-button">{% trans "Delete" %}</li>
|
||||
</ul>
|
||||
|
||||
<fieldset>
|
||||
<legend>{% trans "Page permissions" %}</legend>
|
||||
<ul class="fields">
|
||||
<li class="model_choice_field">
|
||||
{% trans "Choose a different root page" as choose_another_text_str %}
|
||||
{% trans "Choose a root page" as choose_one_text_str %}
|
||||
{% if form.instance.page %}
|
||||
{% include "wagtailadmin/edit_handlers/page_chooser_panel.html" with field=form.page page=form.instance.page is_chosen=True choose_one_text_str=choose_one_text_str choose_another_text_str=choose_another_text_str only %}
|
||||
{% else %}
|
||||
{% include "wagtailadmin/edit_handlers/page_chooser_panel.html" with field=form.page is_chosen=False choose_one_text_str=choose_one_text_str choose_another_text_str=choose_another_text_str only %}
|
||||
{% endif %}
|
||||
</li>
|
||||
<li class="char_field">
|
||||
{% include "wagtailadmin/edit_handlers/field_panel_field.html" with field=form.permission_type only %}
|
||||
</li>
|
||||
</ul>
|
||||
<td>
|
||||
{% trans "Choose a different root page" as choose_another_text_str %}
|
||||
{% trans "Choose a root page" as choose_one_text_str %}
|
||||
|
||||
{% if form.instance.page %}
|
||||
{% include "wagtailadmin/edit_handlers/page_chooser_panel.html" with field=form.page page=form.instance.page is_chosen=True choose_one_text_str=choose_one_text_str choose_another_text_str=choose_another_text_str only %}
|
||||
{% else %}
|
||||
{% include "wagtailadmin/edit_handlers/page_chooser_panel.html" with field=form.page is_chosen=False choose_one_text_str=choose_one_text_str choose_another_text_str=choose_another_text_str only %}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% include "wagtailadmin/edit_handlers/field_panel_field.html" with field=form.permission_type only %}
|
||||
|
||||
{{ form.id }}
|
||||
{{ form.ORDER }}
|
||||
{{ form.DELETE }}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<button class="icon icon-bin" id="{{ form.DELETE.id_for_label }}-button">{% trans "Delete" %}</button>
|
||||
</td>
|
||||
|
||||
{{ form.id }}
|
||||
{{ form.ORDER }}
|
||||
{{ form.DELETE }}
|
||||
{% if form.non_field_errors %}
|
||||
<p class="error-message">
|
||||
{% for error in form.non_field_errors %}
|
||||
<span>{{ error|escape }}</span>
|
||||
{% endfor %}
|
||||
</p>
|
||||
{% endif %}
|
||||
</fieldset>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -3,14 +3,37 @@
|
|||
|
||||
{{ 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 %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<table class="listing">
|
||||
<col width="40%"/>
|
||||
<col width="40%" />
|
||||
<col />
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Page</th>
|
||||
<th>Permission type</th>
|
||||
<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>
|
||||
|
||||
<script type="text/django-form-template" id="id_{{ formset.prefix }}-EMPTY_FORM_TEMPLATE">
|
||||
{% include "wagtailusers/groups/includes/page_permissions_form.html" with form=formset.empty_form only %}
|
||||
<tr>
|
||||
{% include "wagtailusers/groups/includes/page_permissions_form.html" with form=formset.empty_form only %}
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
<p class="add">
|
||||
|
|
|
|||
Loading…
Reference in a new issue