Merge pull request #1441 from gasman/cleanup/page-list-2

Clean up page listing templates - part 2
This commit is contained in:
Karl Hobley 2015-06-29 09:24:50 +01:00
commit bbd4d6d3d1
20 changed files with 221 additions and 164 deletions

View file

@ -8,5 +8,5 @@
{% include "wagtailadmin/shared/breadcrumb.html" with page=parent_page choosing=1 %}
{% if pages %}
{% include "wagtailadmin/pages/list.html" with choosing=1 allow_navigation=1 orderable=0 pages=pages parent_page=parent_page %}
{% include "wagtailadmin/pages/listing/_list_choose.html" with allow_navigation=1 orderable=0 pages=pages parent_page=parent_page %}
{% endif %}

View file

@ -13,5 +13,5 @@
</h2>
{% if pages %}
{% include "wagtailadmin/pages/list.html" with choosing=1 show_parent=1 pages=pages parent_page=parent_page %}
{% include "wagtailadmin/pages/listing/_list_choose.html" with show_parent=1 pages=pages parent_page=parent_page %}
{% endif %}

View file

@ -36,11 +36,7 @@
</td>
<td valign="top"><div class="human-readable-date" title="{{ revision.created_at|date:"d M Y H:i" }}">{{ revision.created_at|timesince }} ago</div></td>
<td valign="top">
{% if revision.page.live %}
<a href="{{ revision.page.url }}" target="_blank" class="status-tag {% if revision.page.status_string != "draft" %}primary{% endif %}">{{ revision.page.status_string }}</a>
{% else %}
<span class="status-tag {% if revision.page.status_string != "draft" %}primary{% endif %}">{{ revision.page.status_string }}</span>
{% endif %}
{% include "wagtailadmin/shared/page_status_tag.html" with page=revision.page %}
</td>
</tr>
{% endfor %}

View file

@ -8,7 +8,7 @@
{% include "wagtailadmin/shared/header.html" with title=pages_str subtitle=page_class.get_verbose_name icon="doc-empty-inverse" %}
<div id="page-results">
{% include "wagtailadmin/pages/usage_results.html" with show_parent="True" %}
{% include "wagtailadmin/pages/usage_results.html" %}
</div>
{% endblock %}

View file

@ -16,11 +16,7 @@
</div>
<div class="right col3">
{% trans "Status" %}
{% if page.live %}
<a href="{{ page.url }}" class="status-tag {% if page.live %}primary{% endif %}">{{ page.status_string }}</a>
{% else %}
<span class="status-tag">{{ page.status_string }}</span>
{% endif %}
{% include "wagtailadmin/shared/page_status_tag.html" with page=page %}
{% include "wagtailadmin/pages/_privacy_switch.html" with page=page page_perms=page_perms only %}
{% include "wagtailadmin/pages/_lock_switch.html" %}

View file

@ -14,7 +14,7 @@
{% csrf_token %}
{% page_permissions parent_page as parent_page_perms %}
{% include "wagtailadmin/pages/list.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 parent_page=parent_page orderable=parent_page_perms.can_reorder_children %}
</form>
{% endblock %}

View file

@ -1,129 +0,0 @@
{% load i18n %}
{% load wagtailadmin_tags %}
<table class="listing{% if full_width %} full-width{% endif %}{% if moving or choosing %} chooser{% endif %}">
{% if orderable %}
<col width="50px" />
{% endif %}
<col />
{% if show_parent %}
<col />
{% endif %}
<col width="12%" />
<col width="12%" />
<col width="12%" />
<col width="10%" />
<thead>
{% if moving or choosing %}
<tr class="table-headers">
{% if orderable %}
<th></th>
{% endif %}
<th class="title">Title</th>
{% if show_parent %}
<th class="parent">{% trans 'Parent' %}</th>
{% endif %}
<th class="updated">{% trans 'Updated' %}</th>
<th class="type">{% trans 'Type' %}</th>
<th class="status">{% trans 'Status' %}</th>
<th></th>
</tr>
{% endif %}
{% if parent_page %}
{% page_permissions parent_page as parent_page_perms %}
<tr class="index {% if not parent_page.live %} unpublished{% endif %} {% if moving or choosing %}{% if parent_page.can_choose %}can-disabled{% endif %}{% endif %}">
<td class="title" {% if orderable %}colspan="2"{% endif %}>
{% if moving %}
{% include "wagtailadmin/pages/listing/_page_title_move.html" with page=parent_page %}
{% elif choosing %}
{% include "wagtailadmin/pages/listing/_page_title_choose.html" with page=parent_page %}
{% else %}
{% include "wagtailadmin/pages/listing/_parent_page_title_explore.html" %}
{% endif %}
</td>
<td class="updated" valign="bottom">{% if parent_page.latest_revision_created_at %}<div class="human-readable-date" title="{{ parent_page.latest_revision_created_at|date:"d M Y H:i" }}">{{ parent_page.latest_revision_created_at|timesince }} ago</div>{% endif %}</td>
<td class="type" valign="bottom">{{ parent_page.content_type.model_class.get_verbose_name }}</td>
<td class="status" valign="bottom">
{% if not choosing and not moving and parent_page.live and not parent_page.is_root and 'view_live' not in hide_actions|default:'' %}
<a href="{{ parent_page.url }}" target="_blank" class="status-tag {% if parent_page.status_string != "draft" %}primary{% endif %}">{{ parent_page.status_string|capfirst }}</a>
{% else %}
<span class="status-tag {% if parent_page.status_string != "draft" %}primary{% endif %}">{{ parent_page.status_string|capfirst }}</span>
{% endif %}
</td>
<td></td>
</tr>
{% endif %}
{% if not moving and not choosing %}
{% include "wagtailadmin/pages/listing/_table_headers_explore.html" %}
{% endif %}
</thead>
<tbody>
{% if pages %}
{% 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 %}{% if moving or choosing %}{% if not page.can_choose %}disabled{% endif %}{% endif %}">
{% if orderable %}
<td class="ord">{% if ordering == "ord" %}<div class="handle icon icon-grip text-replace">{% trans 'Drag' %}</div>{% endif %}</td>
{% endif %}
<td class="title" valign="top">
{% if moving %}
{% include "wagtailadmin/pages/listing/_page_title_move.html" with page=page %}
{% elif choosing %}
{% include "wagtailadmin/pages/listing/_page_title_choose.html" with page=page %}
{% else %}
{% include "wagtailadmin/pages/listing/_page_title_explore.html" %}
{% endif %}
</td>
{% if show_parent %}
{% with page.get_parent as parent %}
<td class="parent" valign="top">
{% if parent %}
<a href="{% url 'wagtailadmin_explore' parent.id %}">{{ parent.title }}</a>
{% endif %}
</td>
{% endwith %}
{% endif %}
<td class="updated" valign="top">{% if page.latest_revision_created_at %}<div class="human-readable-date" title="{{ page.latest_revision_created_at|date:"d M Y H:i" }}">{{ page.latest_revision_created_at|timesince }} ago</div>{% endif %}</td>
<td class="type" valign="top">{{ page.content_type.model_class.get_verbose_name }}</td>
<td class="status" valign="top">
{% if not choosing and not moving and page.live and 'view_live' not in hide_actions|default:'' %}
<a href="{{ page.url }}" target="_blank" class="status-tag {% if page.status_string != "draft" %}primary{% endif %}">{{ page.status_string }}</a>
{% else %}
<span class="status-tag {% if page.status_string != "draft" %}primary{% endif %}">{{ page.status_string }}</span>
{% endif %}
</td>
{% if moving %}
{% include "wagtailadmin/pages/listing/_navigation_move.html" %}
{% elif choosing %}
{% include "wagtailadmin/pages/listing/_navigation_choose.html" %}
{% else %}
{% include "wagtailadmin/pages/listing/_navigation_explore.html" %}
{% endif %}
</tr>
{% endfor %}
{% else %}
{% 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." %}{% if parent_page and parent_page_perms.can_add_subpage %} {% blocktrans %}Why not <a href="{{ add_page_url }}">add one</a>?{% endblocktrans %}{% endif %}</td></tr>
{% endif %}
</tbody>
</table>
{% if parent_page and pages and pages.paginator %}
<div class="pagination">
<p>{% blocktrans with page_number=pages.number num_pages=pages.paginator.num_pages%}
Page {{ page_number }} of {{ num_pages }}.
{% endblocktrans %}</p>
<ul>
<li class="prev">
{% if pages.has_previous %}
<a href="{% url 'wagtailadmin_explore' parent_page.id %}?p={{ pages.previous_page_number }}{% if ordering %}&amp;ordering={{ ordering }}{% endif %}" class="icon icon-arrow-left">{% trans "Previous" %}</a>
{% endif %}
</li>
<li class="next">
{% if pages.has_next %}
<a href="{% url 'wagtailadmin_explore' parent_page.id %}?p={{ pages.next_page_number }}{% if ordering %}&amp;ordering={{ ordering }}{% endif %}" class="icon icon-arrow-right-after">{% trans 'Next' %}</a>
{% endif %}
</li>
</ul>
</div>
{% endif %}

View file

@ -0,0 +1,77 @@
{% load i18n %}
{% load wagtailadmin_tags %}
<table class="listing {% if full_width %}full-width{% endif %} {% block table_classname %}{% endblock %}">
{% if orderable %}
<col width="50px" />
{% endif %}
<col />
{% if show_parent %}
<col />
{% endif %}
<col width="12%" />
<col width="12%" />
<col width="12%" />
<col width="10%" />
<thead>
{% block pre_parent_page_headers %}
{% endblock %}
{% 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 %}>
{% block parent_page_title %}
{% endblock %}
</td>
<td class="updated" valign="bottom">{% if parent_page.latest_revision_created_at %}<div class="human-readable-date" title="{{ parent_page.latest_revision_created_at|date:"d M Y H:i" }}">{{ parent_page.latest_revision_created_at|timesince }} ago</div>{% endif %}</td>
<td class="type" valign="bottom">{{ parent_page.content_type.model_class.get_verbose_name }}</td>
<td class="status" valign="bottom">
{% if not parent_page.is_root %}
{% include "wagtailadmin/shared/page_status_tag.html" with page=parent_page %}
{% endif %}
</td>
<td></td>
</tr>
{% endif %}
{% block post_parent_page_headers %}
{% endblock %}
</thead>
<tbody>
{% if pages %}
{% 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>
{% endif %}
<td class="title" valign="top">
{% block page_title %}
{% endblock %}
</td>
{% if show_parent %}
{% with page.get_parent as parent %}
<td class="parent" valign="top">
{% if parent %}
<a href="{% url 'wagtailadmin_explore' parent.id %}">{{ parent.title }}</a>
{% endif %}
</td>
{% endwith %}
{% endif %}
<td class="updated" valign="top">{% if page.latest_revision_created_at %}<div class="human-readable-date" title="{{ page.latest_revision_created_at|date:"d M Y H:i" }}">{{ page.latest_revision_created_at|timesince }} ago</div>{% endif %}</td>
<td class="type" valign="top">{{ page.content_type.model_class.get_verbose_name }}</td>
<td class="status" valign="top">
{% include "wagtailadmin/shared/page_status_tag.html" with page=page %}
</td>
{% block page_navigation %}
{% endblock %}
</tr>
{% endfor %}
{% else %}
{% block no_results %}{% endblock %}
{% endif %}
</tbody>
</table>
{% block pagination_links %}
{% endblock %}

View file

@ -0,0 +1,38 @@
{% extends "wagtailadmin/pages/listing/_list.html" %}
{% load i18n %}
{# Page listing include, customised for 'choose' mode #}
{% block table_classname %}chooser{% endblock %}
{% block pre_parent_page_headers %}
<tr class="table-headers">
<th class="title">Title</th>
{% if show_parent %}
<th class="parent">{% trans 'Parent' %}</th>
{% endif %}
<th class="updated">{% trans 'Updated' %}</th>
<th class="type">{% trans 'Type' %}</th>
<th class="status">{% trans 'Status' %}</th>
<th></th>
</tr>
{% endblock %}
{% block parent_page_row_classname %}{% if not parent_page.can_choose %}disabled{% endif %}{% endblock %}
{% block parent_page_title %}
{% include "wagtailadmin/pages/listing/_page_title_choose.html" with page=parent_page %}
{% endblock %}
{% block post_parent_page_headers %}{% endblock %}
{% block page_row_classname %}{% if not page.can_choose %}disabled{% endif %}{% endblock %}
{% block page_title %}
{% include "wagtailadmin/pages/listing/_page_title_choose.html" with page=page %}
{% endblock %}
{% block page_navigation %}
{% include "wagtailadmin/pages/listing/_navigation_choose.html" %}
{% endblock %}

View file

@ -0,0 +1,48 @@
{% extends "wagtailadmin/pages/listing/_list.html" %}
{% load i18n %}
{# Page listing include, customised for 'explore' mode #}
{% block parent_page_title %}
{% include "wagtailadmin/pages/listing/_parent_page_title_explore.html" %}
{% endblock %}
{% block post_parent_page_headers %}
{% include "wagtailadmin/pages/listing/_table_headers_explore.html" %}
{% endblock %}
{% block page_title %}
{% include "wagtailadmin/pages/listing/_page_title_explore.html" %}
{% endblock %}
{% block page_navigation %}
{% include "wagtailadmin/pages/listing/_navigation_explore.html" %}
{% endblock %}
{% 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." %}{% if parent_page and parent_page_perms.can_add_subpage %} {% blocktrans %}Why not <a href="{{ add_page_url }}">add one</a>?{% endblocktrans %}{% endif %}</td></tr>
{% endblock %}
{% block pagination_links %}
{% if parent_page and pages and pages.paginator %}
<div class="pagination">
<p>{% blocktrans with page_number=pages.number num_pages=pages.paginator.num_pages %}
Page {{ page_number }} of {{ num_pages }}.
{% endblocktrans %}</p>
<ul>
<li class="prev">
{% if pages.has_previous %}
<a href="{% url 'wagtailadmin_explore' parent_page.id %}?p={{ pages.previous_page_number }}{% if ordering %}&amp;ordering={{ ordering }}{% endif %}" class="icon icon-arrow-left">{% trans "Previous" %}</a>
{% endif %}
</li>
<li class="next">
{% if pages.has_next %}
<a href="{% url 'wagtailadmin_explore' parent_page.id %}?p={{ pages.next_page_number }}{% if ordering %}&amp;ordering={{ ordering }}{% endif %}" class="icon icon-arrow-right-after">{% trans 'Next' %}</a>
{% endif %}
</li>
</ul>
</div>
{% endif %}
{% endblock %}

View file

@ -0,0 +1,38 @@
{% extends "wagtailadmin/pages/listing/_list.html" %}
{% load i18n %}
{# Page listing include, customised for 'move' mode #}
{% block table_classname %}chooser{% endblock %}
{% block pre_parent_page_headers %}
<tr class="table-headers">
<th class="title">Title</th>
{% if show_parent %}
<th class="parent">{% trans 'Parent' %}</th>
{% endif %}
<th class="updated">{% trans 'Updated' %}</th>
<th class="type">{% trans 'Type' %}</th>
<th class="status">{% trans 'Status' %}</th>
<th></th>
</tr>
{% endblock %}
{% block parent_page_row_classname %}{% if not parent_page.can_choose %}disabled{% endif %}{% endblock %}
{% block parent_page_title %}
{% include "wagtailadmin/pages/listing/_page_title_move.html" with page=parent_page %}
{% endblock %}
{% block post_parent_page_headers %}{% endblock %}
{% block page_row_classname %}{% if not page.can_choose %}disabled{% endif %}{% endblock %}
{% block page_title %}
{% include "wagtailadmin/pages/listing/_page_title_move.html" with page=page %}
{% endblock %}
{% block page_navigation %}
{% include "wagtailadmin/pages/listing/_navigation_move.html" %}
{% endblock %}

View file

@ -4,8 +4,8 @@
Navigation controls for the page listing in 'move' mode
{% endcomment %}
<td class="{% if allow_navigation and page.can_descend %}children{% endif %}">
{% if allow_navigation and page.can_descend %}
<td class="{% if page.can_descend %}children{% endif %}">
{% if page.can_descend %}
<a href="{% url 'wagtailadmin_pages_move_choose_destination' page_to_move.id page.id %}" class="icon text-replace icon-arrow-right navigate-pages" title="{% blocktrans with title=page.title %}Explore subpages of '{{ title }}'{% endblocktrans %}">{% trans 'Explore' %}</a>
{% endif %}
</td>

View file

@ -8,6 +8,6 @@
</header>
<div class="nice-padding">
{% include "wagtailadmin/pages/list.html" with moving=1 allow_navigation=1 pages=child_pages parent_page=viewed_page %}
{% include "wagtailadmin/pages/listing/_list_move.html" with pages=child_pages parent_page=viewed_page %}
</div>
{% endblock %}

View file

@ -17,6 +17,6 @@
{% include "wagtailadmin/shared/header.html" with title=search_str search_url="wagtailadmin_pages_search" icon="search" %}
<div id="page-results">
{% include "wagtailadmin/pages/search_results.html" with show_parent="True" %}
{% include "wagtailadmin/pages/search_results.html" %}
</div>
{% endblock %}

View file

@ -22,7 +22,7 @@
</nav>
{% endif %}
{% include "wagtailadmin/pages/list.html" with show_parent=1 allow_navigation=0 %}
{% include "wagtailadmin/pages/listing/_list_explore.html" with show_parent=1 allow_navigation=0 %}
<div class="pagination">
<p>{% blocktrans with page_number=pages.number num_pages=pages.paginator.num_pages%}

View file

@ -1,7 +1,7 @@
{% load i18n %}
<div class="nice-padding">
{% if pages %}
{% include "wagtailadmin/pages/list.html" with show_parent=1 allow_navigation=0 %}
{% include "wagtailadmin/pages/listing/_list_explore.html" with show_parent=1 allow_navigation=0 %}
<div class="pagination">
<p>{% blocktrans with page_number=pages.number num_pages=pages.paginator.num_pages%}

View file

@ -0,0 +1,5 @@
{% if page.live %}
<a href="{{ page.url }}" target="_blank" class="status-tag primary">{{ page.status_string }}</a>
{% else %}
<span class="status-tag">{{ page.status_string }}</span>
{% endif %}

View file

@ -34,11 +34,7 @@
{{ page.content_type.model_class.get_verbose_name }}
</td>
<td>
{% if page.live %}
<a href="{{ page.url }}" target="_blank" class="status-tag {% if page.status_string != "draft" %}primary{% endif %}">{{ page.status_string }}</a>
{% else %}
<span class="status-tag {% if page.status_string != "draft" %}primary{% endif %}">{{ page.status_string }}</span>
{% endif %}
{% include "wagtailadmin/shared/page_status_tag.html" with page=page %}
</td>
</tr>
{% endfor %}

View file

@ -34,11 +34,7 @@
{{ page.content_type.model_class.get_verbose_name }}
</td>
<td>
{% if page.live %}
<a href="{{ page.url }}" target="_blank" class="status-tag {% if page.status_string != "draft" %}primary{% endif %}">{{ page.status_string }}</a>
{% else %}
<span class="status-tag {% if page.status_string != "draft" %}primary{% endif %}">{{ page.status_string }}</span>
{% endif %}
{% include "wagtailadmin/shared/page_status_tag.html" with page=page %}
</td>
</tr>
{% endfor %}

View file

@ -34,11 +34,7 @@
{{ page.content_type.model_class.get_verbose_name }}
</td>
<td>
{% if page.live %}
<a href="{{ page.url }}" target="_blank" class="status-tag {% if page.status_string != "draft" %}primary{% endif %}">{{ page.status_string }}</a>
{% else %}
<span class="status-tag {% if page.status_string != "draft" %}primary{% endif %}">{{ page.status_string }}</span>
{% endif %}
{% include "wagtailadmin/shared/page_status_tag.html" with page=page %}
</td>
</tr>
{% endfor %}