Always add an 'ordering' column to the explorer regardless of permission - fixes #1608

This commit is contained in:
Matt Westcott 2015-08-14 19:12:06 +02:00
parent 1f5dc4c024
commit 1aa0f0b9ef
3 changed files with 14 additions and 11 deletions

View file

@ -14,7 +14,7 @@
{% csrf_token %}
{% page_permissions parent_page as parent_page_perms %}
{% include "wagtailadmin/pages/listing/_list_explore.html" with sortable=1 allow_navigation=1 full_width=1 parent_page=parent_page orderable=parent_page_perms.can_reorder_children %}
{% include "wagtailadmin/pages/listing/_list_explore.html" with sortable=1 allow_navigation=1 full_width=1 show_ordering_column=1 parent_page=parent_page orderable=parent_page_perms.can_reorder_children %}
{% url 'wagtailadmin_explore' parent_page.id as pagination_base_url %}
{% include "wagtailadmin/pages/listing/_pagination.html" with page=pages base_url=pagination_base_url query_params=pagination_query_params only %}

View file

@ -1,7 +1,7 @@
{% load i18n %}
{% load wagtailadmin_tags %}
<table class="listing {% if full_width %}full-width{% endif %} {% block table_classname %}{% endblock %}">
{% if orderable %}
{% if show_ordering_column %}
<col width="50px" />
{% endif %}
<col />
@ -19,7 +19,7 @@
{% if parent_page %}
{% page_permissions parent_page as parent_page_perms %}
<tr class="index {% if not parent_page.live %} unpublished{% endif %} {% block parent_page_row_classname %}{% endblock %}">
<td class="title" {% if orderable %}colspan="2"{% endif %}>
<td class="title" {% if show_ordering_column %}colspan="2"{% endif %}>
{% block parent_page_title %}
{% endblock %}
</td>
@ -46,8 +46,8 @@
{% for page in pages %}
{% page_permissions page as page_perms %}
<tr {% if ordering == "ord" %}id="page_{{ page.id }}" data-page-title="{{ page.title }}"{% endif %} class="{% if not page.live %}unpublished{% endif %} {% block page_row_classname %}{% endblock %}">
{% if orderable %}
<td class="ord">{% if ordering == "ord" %}<div class="handle icon icon-grip text-replace">{% trans 'Drag' %}</div>{% endif %}</td>
{% if show_ordering_column %}
<td class="ord">{% if orderable and ordering == "ord" %}<div class="handle icon icon-grip text-replace">{% trans 'Drag' %}</div>{% endif %}</td>
{% endif %}
<td class="title" valign="top">
{% block page_title %}

View file

@ -5,7 +5,8 @@
Table headers for the page listing, when in 'explore' mode. Expects the following variables:
sortable: if true, headings are links to wagtailadmin_explore with sort parameters applied.
orderable: if true, an 'ordering' column is added (again with links to wagtailadmin_explore).
show_ordering_column: if true, an 'ordering' column is added.
orderable: if true, the 'ordering' column is populated (again with links to wagtailadmin_explore).
If either sortable or orderable is true, the following variables are also required:
@ -15,12 +16,14 @@ ordering: the current sort parameter
{% endcomment %}
<tr class="table-headers">
{% if orderable %}
{% if show_ordering_column %}
<th class="ord">
{% if ordering == "ord" %}
<a href="{% url 'wagtailadmin_explore' parent_page.id %}" class="icon icon-order text-replace" title="{% trans 'Disable ordering of child pages' %}">{% trans 'Order' %}</a></th>
{% else %}
<a href="{% url 'wagtailadmin_explore' parent_page.id %}?ordering=ord" class="icon icon-order text-replace" title="{% trans 'Enable ordering of child pages' %}">{% trans 'Order' %}</a></th>
{% if orderable %}
{% if ordering == "ord" %}
<a href="{% url 'wagtailadmin_explore' parent_page.id %}" class="icon icon-order text-replace" title="{% trans 'Disable ordering of child pages' %}">{% trans 'Order' %}</a></th>
{% else %}
<a href="{% url 'wagtailadmin_explore' parent_page.id %}?ordering=ord" class="icon icon-order text-replace" title="{% trans 'Enable ordering of child pages' %}">{% trans 'Order' %}</a></th>
{% endif %}
{% endif %}
</th>
{% endif %}