kopia lustrzana https://github.com/wagtail/wagtail
Remove unused page listing templates and tags
rodzic
5a0828a066
commit
0b3f4dc1e8
|
@ -1,79 +0,0 @@
|
|||
{% load i18n %}
|
||||
{% load l10n %}
|
||||
{% load wagtailadmin_tags %}
|
||||
<table class="listing {% if full_width %}full-width{% endif %} {% block table_classname %}{% endblock %}" {% if show_ordering_column %}aria-descrption="{% trans 'Press enter to select an item, use up and down arrows to move the item, press enter to complete the move or escape to cancel the current move.' %}"{% endif %}>
|
||||
{% if show_ordering_column or show_bulk_actions %}
|
||||
<col width="10px" />
|
||||
{% endif %}
|
||||
<col />
|
||||
{% if show_parent %}
|
||||
<col />
|
||||
{% endif %}
|
||||
<col width="12%" />
|
||||
<col width="12%" />
|
||||
<col width="12%" />
|
||||
<col width="10%" />
|
||||
<thead>
|
||||
{% block post_parent_page_headers %}
|
||||
{% include "wagtailadmin/pages/listing/_table_headers_explore.html" %}
|
||||
{% endblock %}
|
||||
</thead>
|
||||
<tbody>
|
||||
{% if pages %}
|
||||
{% trans "Select page" as checkbox_aria_label %}
|
||||
{% for page in pages %}
|
||||
{% page_permissions page as page_perms %}
|
||||
<tr {% if ordering == "ord" %}id="page_{{ page.id|unlocalize }}" data-page-title="{{ page.get_admin_display_title }}"{% endif %} class="{% if not page.live %}unpublished{% endif %} {% block page_row_classname %}{% endblock %}">
|
||||
{% if show_ordering_column %}
|
||||
<td class="ord">
|
||||
{% if orderable and ordering == "ord" %}
|
||||
<div class="handle" tabindex="0" aria-live="polite" data-order-handle>
|
||||
{% icon name="grip" classname="default" %}
|
||||
<span class="w-sr-only">
|
||||
{% trans 'Drag' %}
|
||||
<span data-order-label>Item {{ forloop.counter }} of {{ pages|length }}</span>
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% elif show_bulk_actions %}
|
||||
{% include "wagtailadmin/bulk_actions/listing_checkbox_cell.html" with obj_type="page" obj=page aria_labelledby_prefix="page_" aria_labelledby=page.pk|unlocalize aria_labelledby_suffix="_title" %}
|
||||
{% endif %}
|
||||
<td id="page_{{ page.pk|unlocalize }}_title" class="title" valign="top" data-listing-page-title>
|
||||
{% block page_title %}
|
||||
{% include "wagtailadmin/pages/listing/_page_title_explore.html" %}
|
||||
{% endblock %}
|
||||
</td>
|
||||
{% if show_parent %}
|
||||
<td class="parent" valign="top">
|
||||
{% block page_parent_page_title %}
|
||||
{% with page.get_parent as parent %}
|
||||
{% if parent %}
|
||||
<a href="{% url 'wagtailadmin_explore' parent.id %}">{{ parent.specific_deferred.get_admin_display_title }}</a>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% endblock %}
|
||||
</td>
|
||||
{% endif %}
|
||||
<td class="updated" valign="top">
|
||||
{% if page.latest_revision_created_at %}
|
||||
{% human_readable_date page.latest_revision_created_at %}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="type" valign="top">{{ page.page_type_display_name }}</td>
|
||||
<td class="status" valign="top">
|
||||
{% include "wagtailadmin/shared/page_status_tag.html" with page=page %}
|
||||
</td>
|
||||
{% block page_navigation %}
|
||||
{% include "wagtailadmin/pages/listing/_navigation_explore.html" %}
|
||||
{% endblock %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% block no_results %}
|
||||
{% url 'wagtailadmin_pages:add_subpage' parent_page.id as add_page_url%}
|
||||
<tr><td colspan="3" class="no-results-message"><p>{% trans "No pages have been created at this location." %}{% if parent_page and parent_page_perms.can_add_subpage %} {% blocktrans trimmed %}Why not <a href="{{ add_page_url }}">create one</a>?{% endblocktrans %}{% endif %}</p></td></tr>
|
||||
{% endblock %}
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
|
@ -1 +0,0 @@
|
|||
{% extends "wagtailadmin/pages/listing/_list.html" %}
|
|
@ -1,65 +0,0 @@
|
|||
{% load i18n wagtailadmin_tags %}
|
||||
|
||||
{% comment %}
|
||||
|
||||
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.
|
||||
sortable_by_type: must be true to allow sorting on the 'type' column
|
||||
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:
|
||||
|
||||
parent_page: The page instance currently being browsed (used to generate the correct wagtailadmin_explore urls and title text)
|
||||
ordering: the current sort parameter
|
||||
|
||||
{% endcomment %}
|
||||
|
||||
<tr class="table-headers">
|
||||
{% if show_ordering_column %}
|
||||
<th class="ord{% if orderable and ordering == 'ord' %} ord--active{% endif %}">
|
||||
{% if orderable %}
|
||||
{% if ordering == "ord" %}
|
||||
<a href="{% url 'wagtailadmin_explore' parent_page.id %}" title="{% trans 'Disable ordering of child pages' %}">
|
||||
{% icon name="order" %}{% trans 'Sort' %}
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="{% url 'wagtailadmin_explore' parent_page.id %}?ordering=ord" title="{% trans 'Enable ordering of child pages' %}">
|
||||
{% icon name="order" %}{% trans 'Sort' %}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</th>
|
||||
{% elif show_bulk_actions %}
|
||||
{% include 'wagtailadmin/bulk_actions/select_all_checkbox_cell.html' with parent=parent_page.id %}
|
||||
{% endif %}
|
||||
<th class="title">
|
||||
{% trans 'Title' as title_label %}
|
||||
{% page_table_header_label label=title_label sortable=sortable sort_field='title' parent_page_title=parent_page.title %}
|
||||
</th>
|
||||
{% if show_parent %}
|
||||
<th class="parent">
|
||||
{% trans 'Parent' as parent_label %}
|
||||
{% page_table_header_label label=parent_label sortable=0 parent_page_title=parent_page.title %}
|
||||
</th>
|
||||
{% endif %}
|
||||
<th class="updated">
|
||||
{% trans 'Updated' as updated_label %}
|
||||
{% page_table_header_label label=updated_label sortable=sortable sort_field='latest_revision_created_at' parent_page_title=parent_page.title %}
|
||||
</th>
|
||||
<th class="type">
|
||||
{% trans 'Type' as type_label %}
|
||||
|
||||
{% if sortable and sortable_by_type %}
|
||||
{% page_table_header_label label=type_label sortable=1 sort_field='content_type' parent_page_title=parent_page.title %}
|
||||
{% else %}
|
||||
{% page_table_header_label label=type_label sortable=0 parent_page_title=parent_page.title %}
|
||||
{% endif %}
|
||||
</th>
|
||||
<th class="status">
|
||||
{% trans 'Status' as status_label %}
|
||||
{% page_table_header_label label=status_label sortable=sortable sort_field='live' parent_page_title=parent_page.title %}
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
|
@ -19,7 +19,7 @@ from django.urls import reverse
|
|||
from django.urls.exceptions import NoReverseMatch
|
||||
from django.utils import timezone
|
||||
from django.utils.encoding import force_str
|
||||
from django.utils.html import avoid_wrapping, format_html, format_html_join, json_script
|
||||
from django.utils.html import avoid_wrapping, json_script
|
||||
from django.utils.http import urlencode
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.timesince import timesince
|
||||
|
@ -390,113 +390,6 @@ def querystring(context, **kwargs):
|
|||
return "?" + querydict.urlencode()
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def page_table_header_label(context, label=None, parent_page_title=None, **kwargs):
|
||||
"""
|
||||
Wraps table_header_label to add a title attribute based on the parent page title and the column label
|
||||
"""
|
||||
if label:
|
||||
translation_context = {"parent": parent_page_title, "label": label}
|
||||
ascending_title_text = (
|
||||
_(
|
||||
"Sort the order of child pages within '%(parent)s' by '%(label)s' in ascending order."
|
||||
)
|
||||
% translation_context
|
||||
)
|
||||
descending_title_text = (
|
||||
_(
|
||||
"Sort the order of child pages within '%(parent)s' by '%(label)s' in descending order."
|
||||
)
|
||||
% translation_context
|
||||
)
|
||||
else:
|
||||
ascending_title_text = None
|
||||
descending_title_text = None
|
||||
|
||||
return table_header_label(
|
||||
context,
|
||||
label=label,
|
||||
ascending_title_text=ascending_title_text,
|
||||
descending_title_text=descending_title_text,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def table_header_label(
|
||||
context,
|
||||
label=None,
|
||||
sortable=True,
|
||||
ordering=None,
|
||||
sort_context_var="ordering",
|
||||
sort_param="ordering",
|
||||
sort_field=None,
|
||||
ascending_title_text=None,
|
||||
descending_title_text=None,
|
||||
):
|
||||
"""
|
||||
A label to go in a table header cell, optionally with a 'sort' link that alternates between
|
||||
forward and reverse sorting
|
||||
|
||||
label = label text
|
||||
ordering = current active ordering. If not specified, we will fetch it from the template context variable
|
||||
given by sort_context_var. (We don't fetch it from the URL because that wouldn't give the view method
|
||||
the opportunity to set a default)
|
||||
sort_param = URL parameter that indicates the current active ordering
|
||||
sort_field = the value for sort_param that indicates that sorting is currently on this column.
|
||||
For example, if sort_param='ordering' and sort_field='title', then a URL parameter of
|
||||
ordering=title indicates that the listing is ordered forwards on this column, and a URL parameter
|
||||
of ordering=-title indicated that the listing is ordered in reverse on this column
|
||||
ascending_title_text = title attribute to use on the link when the link action will sort in ascending order
|
||||
descending_title_text = title attribute to use on the link when the link action will sort in descending order
|
||||
|
||||
To disable sorting on this column, set sortable=False or leave sort_field unspecified.
|
||||
"""
|
||||
if not sortable or not sort_field:
|
||||
# render label without a sort link
|
||||
return label
|
||||
|
||||
if ordering is None:
|
||||
ordering = context.get(sort_context_var)
|
||||
reverse_sort_field = "-%s" % sort_field
|
||||
|
||||
if ordering == sort_field:
|
||||
# currently ordering forwards on this column; link should change to reverse ordering
|
||||
attrs = {
|
||||
"href": querystring(context, **{sort_param: reverse_sort_field}),
|
||||
"class": "icon icon-arrow-down-after teal",
|
||||
}
|
||||
if descending_title_text is not None:
|
||||
attrs["title"] = descending_title_text
|
||||
|
||||
elif ordering == reverse_sort_field:
|
||||
# currently ordering backwards on this column; link should change to forward ordering
|
||||
attrs = {
|
||||
"href": querystring(context, **{sort_param: sort_field}),
|
||||
"class": "icon icon-arrow-up-after teal",
|
||||
}
|
||||
if ascending_title_text is not None:
|
||||
attrs["title"] = ascending_title_text
|
||||
|
||||
else:
|
||||
# not currently ordering on this column; link should change to forward ordering
|
||||
attrs = {
|
||||
"href": querystring(context, **{sort_param: sort_field}),
|
||||
"class": "icon icon-arrow-down-after",
|
||||
}
|
||||
if ascending_title_text is not None:
|
||||
attrs["title"] = ascending_title_text
|
||||
|
||||
attrs_string = format_html_join(" ", '{}="{}"', attrs.items())
|
||||
|
||||
return format_html(
|
||||
# need whitespace around label for correct positioning of arrow icon
|
||||
"<a {attrs}> {label} </a>",
|
||||
attrs=attrs_string,
|
||||
label=label,
|
||||
)
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def pagination_querystring(context, page_number, page_key="p"):
|
||||
"""
|
||||
|
|
Ładowanie…
Reference in New Issue