Merge pull request #1189 from gasman/cleanup/page-list

Clean up wagtailadmin/pages/list.html
This commit is contained in:
Karl Hobley 2015-04-15 13:21:37 +01:00
commit 54eb98f8d4
20 changed files with 272 additions and 215 deletions

View file

@ -23,14 +23,8 @@
<h2>
<a href="{% url 'wagtailadmin_pages_edit' revision.page.id %}" title="{% trans 'Edit this page' %}">{{ revision.page.title }}</a>
{% test_page_is_public revision.page as is_public %}
{% if not is_public %}
<span class="indicator privacy-indicator icon icon-no-view" title="{% trans 'This page is protected from public view' %}"></span>
{% endif %}
{% if revision.page.locked %}
<span class="indicator locked-indicator icon icon-locked" title="{% trans 'This page is locked to further editing' %}"></span>
{% endif %}
{% include "wagtailadmin/pages/listing/_privacy_indicator.html" with page=revision.page %}
{% include "wagtailadmin/pages/listing/_locked_indicator.html" with page=revision.page %}
</h2>
<ul class="actions">
<li>

View file

@ -21,14 +21,8 @@
<h2>
<a href="{% url 'wagtailadmin_pages_edit' revision.page.id %}" title="{% trans 'Edit this page' %}">{{ revision.page.title }}</a>
{% test_page_is_public revision.page as is_public %}
{% if not is_public %}
<span class="indicator privacy-indicator icon icon-no-view" title="{% trans 'This page is protected from public view' %}"></span>
{% endif %}
{% if revision.page.locked %}
<span class="indicator locked-indicator icon icon-locked" title="{% trans 'This page is locked to further editing' %}"></span>
{% endif %}
{% include "wagtailadmin/pages/listing/_privacy_indicator.html" with page=revision.page %}
{% include "wagtailadmin/pages/listing/_locked_indicator.html" with page=revision.page %}
</h2>
<ul class="actions">
<li><a href="{% url 'wagtailadmin_pages_edit' revision.page.id %}" class="button button-small button-secondary">{% trans "Edit" %}</a></li>

View file

@ -22,7 +22,7 @@
<script src="{{ STATIC_URL }}wagtailadmin/js/page-editor.js"></script>
<script src="{{ STATIC_URL }}wagtailadmin/js/page-chooser.js"></script>
<script src="{{ STATIC_URL }}admin/js/urlify.js"></script>
<script src="{{ STATIC_URL }}wagtailadmin/js/privacy-indicator.js"></script>
<script src="{{ STATIC_URL }}wagtailadmin/js/privacy-switch.js"></script>
{% hook_output 'insert_editor_js' %}
{% endcompress %}

View file

@ -22,8 +22,8 @@
<span class="status-tag">{{ page.status_string }}</span>
{% endif %}
{% include "wagtailadmin/pages/_privacy_indicator.html" with page=page page_perms=page_perms only %}
{% include "wagtailadmin/pages/_lock_indicator.html" %}
{% include "wagtailadmin/pages/_privacy_switch.html" with page=page page_perms=page_perms only %}
{% include "wagtailadmin/pages/_lock_switch.html" %}
</div>
</div>
</header>

View file

@ -21,7 +21,7 @@
{% block extra_js %}
{% comment %} modal-workflow is required by the view restrictions interface {% endcomment %}
<script src="{{ STATIC_URL }}wagtailadmin/js/modal-workflow.js"></script>
<script src="{{ STATIC_URL }}wagtailadmin/js/privacy-indicator.js"></script>
<script src="{{ STATIC_URL }}wagtailadmin/js/privacy-switch.js"></script>
<script type="text/javascript">
{% if ordering == 'ord' %}

View file

@ -33,70 +33,11 @@
<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 %}
<h2>
{% if parent_page.can_choose %}
<a href="{% url 'wagtailadmin_pages_move_confirm' page_to_move.id parent_page.id %}">{{ parent_page.title }}</a>
{% else %}
{{ parent_page.title }}
{% endif %}
{% test_page_is_public parent_page as is_public %}
{% if not is_public %}
<span class="indicator privacy-indicator icon icon-no-view" title="{% trans "This page is protected from public view" %}"></span>
{% endif %}
</h2>
{% include "wagtailadmin/pages/listing/_page_title_move.html" with page=parent_page %}
{% elif choosing %}
<h2>
{% if parent_page.can_choose %}
<a class="choose-page" href="#{{ parent_page.id }}" data-id="{{ parent_page.id }}" data-title="{{ parent_page.title }}" data-url="{{ parent_page.url }}" data-edit-url="{% url 'wagtailadmin_pages_edit' parent_page.id %}">{{ parent_page.title }}</a>
{% else %}
{{ parent_page.title }}
{% endif %}
{% test_page_is_public parent_page as is_public %}
{% if not is_public %}
<span class="indicator privacy-indicator icon icon-no-view" title="This page is protected from public view"></span>
{% endif %}
</h2>
{% include "wagtailadmin/pages/listing/_page_title_choose.html" with page=parent_page %}
{% else %}
<h2>
{% if parent_page_perms.can_edit and 'edit' not in hide_actions|default:'' %}
<a href="{% url 'wagtailadmin_pages_edit' parent_page.id %}">{{ parent_page.title }}</a>
{% else %}
{{ parent_page.title }}
{% endif %}
{% if parent_page.locked %}
<span class="indicator locked-indicator icon icon-locked" title="{% trans "This page is locked to further editing" %}"></span>
{% endif %}
</h2>
{% include "wagtailadmin/pages/_privacy_indicator.html" with page=parent_page %}
<ul class="actions">
{% if parent_page_perms.can_edit and 'edit' not in hide_actions|default:'' %}
<li><a href="{% url 'wagtailadmin_pages_edit' parent_page.id %}" class="button button-small button-secondary">{% trans 'Edit' %}</a></li>
{% endif %}
{% if parent_page.has_unpublished_changes and 'view_draft' not in hide_actions|default:'' %}
<li><a href="{% url 'wagtailadmin_pages_view_draft' parent_page.id %}" class="button button-small button-secondary" target="_blank">{% trans 'Draft' %}</a></li>
{% endif %}
{% if parent_page.live and not parent_page.is_root and 'view_live' not in hide_actions|default:'' %}
<li><a {% if parent_page.url %}href="{{ parent_page.url }}"{% endif %} class="button button-small button-secondary {% if not parent_page.url %}disabled{% endif %}" target="_blank" {% if not parent_page.url %}title="{% trans 'This page is published but does not exist within a configured Site, so cannot be viewed.' %}"{% endif %}>{% trans 'Live' %}</a></li>
{% endif %}
{% if parent_page_perms.can_move and 'move' not in hide_actions|default:'' %}
<li><a href="{% url 'wagtailadmin_pages_move' parent_page.id %}" class="button button-small button-secondary">{% trans 'Move' %}</a></li>
{% endif %}
{% if parent_page_perms.can_delete and 'delete' not in hide_actions|default:'' %}
<li><a href="{% url 'wagtailadmin_pages_delete' parent_page.id %}" class="button button-small button-secondary">{% trans 'Delete' %}</a></li>
{% endif %}
{% if parent_page_perms.can_unpublish and 'unpublish' not in hide_actions|default:'' %}
<li><a href="{% url 'wagtailadmin_pages_unpublish' parent_page.id %}" class="button button-small button-secondary">{% trans 'Unpublish' %}</a></li>
{% endif %}
{% if parent_page_perms.can_add_subpage and 'add_subpage' not in hide_actions|default:'' %}
<li><a href="{% url 'wagtailadmin_pages_add_subpage' parent_page.id %}" class="button button-small bicolor icon white icon-plus">{% trans 'Add child page' %}</a></li>
{% endif %}
</ul>
{% 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>
@ -113,57 +54,7 @@
{% endif %}
{% if not moving and not choosing %}
<tr class="table-headers">
{% if orderable %}
<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>
{% endif %}
</th>
{% endif %}
<th class="title">
{% if sortable %}
<a href="{% url 'wagtailadmin_explore' parent_page.id %}?ordering={% if ordering == "title" %}-{% endif %}title" class="icon icon-arrow-{% if ordering == "title" %}down-after{% elif ordering == "-title" %}up-after{% else %}down-after{% endif %} {% if ordering == "title" or ordering == "-title" %}teal{% endif %}">
{% trans 'Title' %}
</a>
{% else %}
{% trans 'Title' %}
{% endif %}
</th>
{% if show_parent %}
<th class="parent">{% trans 'Parent' %}</th>
{% endif %}
<th class="updated">
{% if sortable %}
<a href="{% url 'wagtailadmin_explore' parent_page.id %}?ordering={% if ordering == "latest_revision_created_at" %}-{% endif %}latest_revision_created_at" class="icon icon-arrow-{% if ordering == "-latest_revision_created_at" %}up-after{% else %}down-after{% endif %} {% if ordering == "latest_revision_created_at" or ordering == "-latest_revision_created_at" %}teal {% endif %}">
{% trans 'Updated' %}
</a>
{% else %}
{% trans 'Updated' %}
{% endif %}
</th>
<th class="type">
{% if sortable %}
<a href="{% url 'wagtailadmin_explore' parent_page.id %}?ordering={% if ordering == "content_type" %}-{% endif %}content_type" class="icon icon-arrow-{% if ordering == "-content_type" %}up-after{% else %}down-after{% endif %} {% if ordering == "content_type" or ordering == "-content_type" %}teal {% endif %}">
{% trans 'Type' %}
</a>
{% else %}
{% trans 'Type' %}
{% endif %}
</th>
<th class="status">
{% if sortable %}
<a href="{% url 'wagtailadmin_explore' parent_page.id %}?ordering={% if ordering == "live" %}-{% endif %}live" class="icon icon-arrow-{% if ordering == "-live" %}up-after{% else %}down-after{% endif %} {% if ordering == "live" or ordering == "-live" %}teal {% endif %}">
{% trans 'Status' %}
</a>
{% else %}
{% trans 'Status' %}
{% endif %}
</th>
<th></th>
</tr>
{% include "wagtailadmin/pages/listing/_table_headers_explore.html" %}
{% endif %}
</thead>
<tbody>
@ -175,63 +66,12 @@
<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">
<h2>
{% if moving %}
{% if page.can_choose %}
<a href="{% url 'wagtailadmin_pages_move_confirm' page_to_move.id page.id %}">{{ page.title }}</a>
{% else %}
{{ page.title }}
{% endif %}
{% elif choosing %}
{% if page.can_choose %}
<a class="choose-page" href="#{{ page.id }}" data-id="{{ page.id }}" data-title="{{ page.title }}" data-url="{{ page.url }}" data-edit-url="{% url 'wagtailadmin_pages_edit' page.id %}">{{ page.title }}</a>
{% else %}
{{ page.title }}
{% endif %}
{% else %}
{% if page_perms.can_edit and 'edit' not in hide_actions|default:'' %}
<a href="{% url 'wagtailadmin_pages_edit' page.id %}" title="{% trans 'Edit this page' %}">{{ page.title }}</a>
{% else %}
{{ page.title }}
{% endif %}
{% endif %}
{% test_page_is_public page as is_public %}
{% if not is_public %}
<span class="indicator privacy-indicator icon icon-no-view" title="{% trans 'This page is protected from public view' %}"></span>
{% endif %}
{% if page.locked %}
<span class="indicator locked-indicator icon icon-locked" title="{% trans 'This page is locked to further editing' %}"></span>
{% endif %}
</h2>
{% if not moving and not choosing %}
<ul class="actions">
{% if page_perms.can_edit and 'edit' not in hide_actions|default:'' %}
<li><a href="{% url 'wagtailadmin_pages_edit' page.id %}" class="button button-small button-secondary" title="{% trans 'Edit this page' %}">{% trans 'Edit' %}</a></li>
{% endif %}
{% if page.has_unpublished_changes and 'view_draft' not in hide_actions|default:'' %}
<li><a href="{% url 'wagtailadmin_pages_view_draft' page.id %}" class="button button-small button-secondary" target="_blank">{% trans 'Draft' %}</a></li>
{% endif %}
{% if page.live and 'view_live' not in hide_actions|default:'' %}
<li><a {% if page.url %}href="{{ page.url }}"{% endif %} class="button button-small button-secondary {% if not page.url %}disabled{% endif %}" target="_blank" {% if not page.url %}title="{% trans 'This page is published but does not exist within a configured Site, so cannot be viewed.' %}"{% endif %}>{% trans 'Live' %}</a></li>
{% endif %}
{% if page_perms.can_move and 'move' not in hide_actions|default:'' %}
<li><a href="{% url 'wagtailadmin_pages_move' page.id %}" class="button button-small button-secondary">{% trans 'Move' %}</a></li>
{% endif %}
{% if parent_page_perms.can_add_subpage and 'copy' not in hide_actions|default:'' %}
<li><a href="{% url 'wagtailadmin_pages_copy' page.id %}" class="button button-small button-secondary">{% trans 'Copy' %}</a></li>
{% endif %}
{% if page_perms.can_delete and 'delete' not in hide_actions|default:'' %}
<li><a href="{% url 'wagtailadmin_pages_delete' page.id %}" class="button button-small button-secondary">{% trans 'Delete' %}</a></li>
{% endif %}
{% if page_perms.can_unpublish and 'unpublish' not in hide_actions|default:'' %}
<li><a href="{% url 'wagtailadmin_pages_unpublish' page.id %}" class="button button-small button-secondary">{% trans 'Unpublish' %}</a></li>
{% endif %}
{% if page_perms.can_add_subpage and 'add_subpage' not in hide_actions|default:'' %}
<li><a href="{% url 'wagtailadmin_pages_add_subpage' page.id %}" class="button button-small button-secondary">{% trans 'Add child page' %}</a></li>
{% endif %}
</ul>
{% 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 %}
@ -252,25 +92,13 @@
<span class="status-tag {% if page.status_string != "draft" %}primary{% endif %}">{{ page.status_string }}</span>
{% endif %}
</td>
<td class="{% if allow_navigation %}{% if choosing %}{% if page.can_descend %} children{% endif%}{% elif moving %}{% if page.can_descend %} children{% endif%}{% elif allow_navigation and page.is_navigable %} children{% else %}no-children{% endif %}{% endif %}">
{% if allow_navigation %}
{% if moving %}
{% 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 %}Explorer subpages of '{{ title }}'{% endblocktrans %}">{% trans 'Explore' %}</a>
{% endif %}
{% elif choosing %}
{% if page.can_descend %}
<a href="{% url 'wagtailadmin_choose_page_child' page.id %}?{{ querystring }}" class="icon text-replace icon-arrow-right navigate-pages" title="{% blocktrans with title=page.title %}Explorer subpages of '{{ title }}'{% endblocktrans %}">{% trans 'Explore' %}</a>
{% endif %}
{% else %}
{% if page.is_navigable %}
<a href="{% url 'wagtailadmin_explore' page.id %}" class="icon text-replace icon-arrow-right" title="{% blocktrans with title=page.title %}Explore child pages of '{{ title }}'{% endblocktrans %}">{% trans "Explore" %}</a>
{% elif page_perms.can_add_subpage %}
<a href="{% url 'wagtailadmin_pages_add_subpage' page.id %}" class="icon text-replace icon-plus-inverse" title="{% blocktrans with title=page.title %}Add a child page to '{{ title }}'{% endblocktrans %}">{% trans 'Add subpage' %}</a>
{% endif %}
{% endif %}
{% 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 %}

View file

@ -0,0 +1,11 @@
{% load i18n %}
{% load wagtailadmin_tags %}
{% comment %}
Expects a variable 'page', a page object.
Tests whether that page is locked for editing, and if so, outputs a 'locked' icon.
{% endcomment %}
{% if page.locked %}
<span class="indicator locked-indicator icon icon-locked" title="{% trans 'This page is locked to further editing' %}"></span>
{% endif %}

View file

@ -0,0 +1,11 @@
{% load i18n %}
{% comment %}
Navigation controls for the page listing in 'choose' mode
{% endcomment %}
<td class="{% if allow_navigation and page.can_descend %}children{% endif %}">
{% if allow_navigation and page.can_descend %}
<a href="{% url 'wagtailadmin_choose_page_child' page.id %}?{{ querystring }}" 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

@ -0,0 +1,15 @@
{% load i18n %}
{% comment %}
Navigation controls for the page listing in 'explore' mode
{% endcomment %}
<td class="{% if allow_navigation %}{% if page.is_navigable %}children{% else %}no-children{% endif %}{% endif %}">
{% if allow_navigation %}
{% if page.is_navigable %}
<a href="{% url 'wagtailadmin_explore' page.id %}" class="icon text-replace icon-arrow-right" title="{% blocktrans with title=page.title %}Explore child pages of '{{ title }}'{% endblocktrans %}">{% trans "Explore" %}</a>
{% elif page_perms.can_add_subpage %}
<a href="{% url 'wagtailadmin_pages_add_subpage' page.id %}" class="icon text-replace icon-plus-inverse" title="{% blocktrans with title=page.title %}Add a child page to '{{ title }}'{% endblocktrans %}">{% trans 'Add subpage' %}</a>
{% endif %}
{% endif %}
</td>

View file

@ -0,0 +1,11 @@
{% load i18n %}
{% comment %}
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 %}
<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

@ -0,0 +1,16 @@
{% comment %}
The title field for a page in the page listing, when in 'choose' mode.
Expects a variable 'page', the page instance.
{% endcomment %}
<h2>
{% if page.can_choose %}
<a class="choose-page" href="#{{ page.id }}" data-id="{{ page.id }}" data-title="{{ page.title }}" data-url="{{ page.url }}" data-edit-url="{% url 'wagtailadmin_pages_edit' page.id %}">{{ page.title }}</a>
{% else %}
{{ page.title }}
{% endif %}
{% include "wagtailadmin/pages/listing/_privacy_indicator.html" with page=page %}
{% include "wagtailadmin/pages/listing/_locked_indicator.html" with page=page %}
</h2>

View file

@ -0,0 +1,41 @@
{% load i18n %}
{# The title field for a page in the page listing, when in 'explore' mode #}
<h2>
{% if page_perms.can_edit and 'edit' not in hide_actions|default:'' %}
<a href="{% url 'wagtailadmin_pages_edit' page.id %}" title="{% trans 'Edit this page' %}">{{ page.title }}</a>
{% else %}
{{ page.title }}
{% endif %}
{% include "wagtailadmin/pages/listing/_privacy_indicator.html" with page=page %}
{% include "wagtailadmin/pages/listing/_locked_indicator.html" with page=page %}
</h2>
<ul class="actions">
{% if page_perms.can_edit and 'edit' not in hide_actions|default:'' %}
<li><a href="{% url 'wagtailadmin_pages_edit' page.id %}" class="button button-small button-secondary" title="{% trans 'Edit this page' %}">{% trans 'Edit' %}</a></li>
{% endif %}
{% if page.has_unpublished_changes and 'view_draft' not in hide_actions|default:'' %}
<li><a href="{% url 'wagtailadmin_pages_view_draft' page.id %}" class="button button-small button-secondary" target="_blank">{% trans 'Draft' %}</a></li>
{% endif %}
{% if page.live and 'view_live' not in hide_actions|default:'' %}
<li><a {% if page.url %}href="{{ page.url }}"{% endif %} class="button button-small button-secondary {% if not page.url %}disabled{% endif %}" target="_blank" {% if not page.url %}title="{% trans 'This page is published but does not exist within a configured Site, so cannot be viewed.' %}"{% endif %}>{% trans 'Live' %}</a></li>
{% endif %}
{% if page_perms.can_move and 'move' not in hide_actions|default:'' %}
<li><a href="{% url 'wagtailadmin_pages_move' page.id %}" class="button button-small button-secondary">{% trans 'Move' %}</a></li>
{% endif %}
{% if parent_page_perms.can_add_subpage and 'copy' not in hide_actions|default:'' %}
<li><a href="{% url 'wagtailadmin_pages_copy' page.id %}" class="button button-small button-secondary">{% trans 'Copy' %}</a></li>
{% endif %}
{% if page_perms.can_delete and 'delete' not in hide_actions|default:'' %}
<li><a href="{% url 'wagtailadmin_pages_delete' page.id %}" class="button button-small button-secondary">{% trans 'Delete' %}</a></li>
{% endif %}
{% if page_perms.can_unpublish and 'unpublish' not in hide_actions|default:'' %}
<li><a href="{% url 'wagtailadmin_pages_unpublish' page.id %}" class="button button-small button-secondary">{% trans 'Unpublish' %}</a></li>
{% endif %}
{% if page_perms.can_add_subpage and 'add_subpage' not in hide_actions|default:'' %}
<li><a href="{% url 'wagtailadmin_pages_add_subpage' page.id %}" class="button button-small button-secondary">{% trans 'Add child page' %}</a></li>
{% endif %}
</ul>

View file

@ -0,0 +1,16 @@
{% comment %}
The title field for a page in the page listing, when in 'move' mode.
Expects a variable 'page', the page instance.
{% endcomment %}
<h2>
{% if page.can_choose %}
<a href="{% url 'wagtailadmin_pages_move_confirm' page_to_move.id page.id %}">{{ page.title }}</a>
{% else %}
{{ page.title }}
{% endif %}
{% include "wagtailadmin/pages/listing/_privacy_indicator.html" with page=page %}
{% include "wagtailadmin/pages/listing/_locked_indicator.html" with page=page %}
</h2>

View file

@ -0,0 +1,41 @@
{% load i18n %}
{% load wagtailadmin_tags %}
{# The title field for a parent page when the listing is in 'explore' mode #}
<h2>
{% if parent_page_perms.can_edit and 'edit' not in hide_actions|default:'' %}
<a href="{% url 'wagtailadmin_pages_edit' parent_page.id %}">{{ parent_page.title }}</a>
{% else %}
{{ parent_page.title }}
{% endif %}
{% include "wagtailadmin/pages/listing/_locked_indicator.html" with page=parent_page %}
</h2>
{% include "wagtailadmin/pages/_privacy_switch.html" with page=parent_page %}
<ul class="actions">
{% if parent_page_perms.can_edit and 'edit' not in hide_actions|default:'' %}
<li><a href="{% url 'wagtailadmin_pages_edit' parent_page.id %}" class="button button-small button-secondary">{% trans 'Edit' %}</a></li>
{% endif %}
{% if parent_page.has_unpublished_changes and 'view_draft' not in hide_actions|default:'' %}
<li><a href="{% url 'wagtailadmin_pages_view_draft' parent_page.id %}" class="button button-small button-secondary" target="_blank">{% trans 'Draft' %}</a></li>
{% endif %}
{% if parent_page.live and not parent_page.is_root and 'view_live' not in hide_actions|default:'' %}
<li><a {% if parent_page.url %}href="{{ parent_page.url }}"{% endif %} class="button button-small button-secondary {% if not parent_page.url %}disabled{% endif %}" target="_blank" {% if not parent_page.url %}title="{% trans 'This page is published but does not exist within a configured Site, so cannot be viewed.' %}"{% endif %}>{% trans 'Live' %}</a></li>
{% endif %}
{% if parent_page_perms.can_move and 'move' not in hide_actions|default:'' %}
<li><a href="{% url 'wagtailadmin_pages_move' parent_page.id %}" class="button button-small button-secondary">{% trans 'Move' %}</a></li>
{% endif %}
{% if parent_page_perms.can_delete and 'delete' not in hide_actions|default:'' %}
<li><a href="{% url 'wagtailadmin_pages_delete' parent_page.id %}" class="button button-small button-secondary">{% trans 'Delete' %}</a></li>
{% endif %}
{% if parent_page_perms.can_unpublish and 'unpublish' not in hide_actions|default:'' %}
<li><a href="{% url 'wagtailadmin_pages_unpublish' parent_page.id %}" class="button button-small button-secondary">{% trans 'Unpublish' %}</a></li>
{% endif %}
{% if parent_page_perms.can_add_subpage and 'add_subpage' not in hide_actions|default:'' %}
<li><a href="{% url 'wagtailadmin_pages_add_subpage' parent_page.id %}" class="button button-small bicolor icon white icon-plus">{% trans 'Add child page' %}</a></li>
{% endif %}
</ul>

View file

@ -0,0 +1,12 @@
{% load i18n %}
{% load wagtailadmin_tags %}
{% comment %}
Expects a variable 'page', a page object.
Tests whether that page is protected from public view, and if so, outputs a 'protected' icon.
{% endcomment %}
{% test_page_is_public page as is_public %}
{% if not is_public %}
<span class="indicator privacy-indicator icon icon-no-view" title="{% trans "This page is protected from public view" %}"></span>
{% endif %}

View file

@ -0,0 +1,67 @@
{% load i18n %}
{% 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.
orderable: if true, an 'ordering' column is added (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)
ordering: the current sort parameter
{% endcomment %}
<tr class="table-headers">
{% if orderable %}
<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>
{% endif %}
</th>
{% endif %}
<th class="title">
{% if sortable %}
<a href="{% url 'wagtailadmin_explore' parent_page.id %}?ordering={% if ordering == "title" %}-{% endif %}title" class="icon icon-arrow-{% if ordering == "title" %}down-after{% elif ordering == "-title" %}up-after{% else %}down-after{% endif %} {% if ordering == "title" or ordering == "-title" %}teal{% endif %}">
{% trans 'Title' %}
</a>
{% else %}
{% trans 'Title' %}
{% endif %}
</th>
{% if show_parent %}
<th class="parent">{% trans 'Parent' %}</th>
{% endif %}
<th class="updated">
{% if sortable %}
<a href="{% url 'wagtailadmin_explore' parent_page.id %}?ordering={% if ordering == "latest_revision_created_at" %}-{% endif %}latest_revision_created_at" class="icon icon-arrow-{% if ordering == "-latest_revision_created_at" %}up-after{% else %}down-after{% endif %} {% if ordering == "latest_revision_created_at" or ordering == "-latest_revision_created_at" %}teal {% endif %}">
{% trans 'Updated' %}
</a>
{% else %}
{% trans 'Updated' %}
{% endif %}
</th>
<th class="type">
{% if sortable %}
<a href="{% url 'wagtailadmin_explore' parent_page.id %}?ordering={% if ordering == "content_type" %}-{% endif %}content_type" class="icon icon-arrow-{% if ordering == "-content_type" %}up-after{% else %}down-after{% endif %} {% if ordering == "content_type" or ordering == "-content_type" %}teal {% endif %}">
{% trans 'Type' %}
</a>
{% else %}
{% trans 'Type' %}
{% endif %}
</th>
<th class="status">
{% if sortable %}
<a href="{% url 'wagtailadmin_explore' parent_page.id %}?ordering={% if ordering == "live" %}-{% endif %}live" class="icon icon-arrow-{% if ordering == "-live" %}up-after{% else %}down-after{% endif %} {% if ordering == "live" or ordering == "-live" %}teal {% endif %}">
{% trans 'Status' %}
</a>
{% else %}
{% trans 'Status' %}
{% endif %}
</th>
<th></th>
</tr>

View file

@ -162,7 +162,7 @@ class TestPrivacyIndicators(TestCase, WagtailTestUtils):
self.assertEqual(response.status_code, 200)
# Check the privacy indicator is public
self.assertTemplateUsed(response, 'wagtailadmin/pages/_privacy_indicator.html')
self.assertTemplateUsed(response, 'wagtailadmin/pages/_privacy_switch.html')
self.assertContains(response, '<div class="privacy-indicator public">')
self.assertNotContains(response, '<div class="privacy-indicator private">')
@ -176,7 +176,7 @@ class TestPrivacyIndicators(TestCase, WagtailTestUtils):
self.assertEqual(response.status_code, 200)
# Check the privacy indicator is public
self.assertTemplateUsed(response, 'wagtailadmin/pages/_privacy_indicator.html')
self.assertTemplateUsed(response, 'wagtailadmin/pages/_privacy_switch.html')
self.assertContains(response, '<div class="privacy-indicator private">')
self.assertNotContains(response, '<div class="privacy-indicator public">')
@ -190,7 +190,7 @@ class TestPrivacyIndicators(TestCase, WagtailTestUtils):
self.assertEqual(response.status_code, 200)
# Check the privacy indicator is public
self.assertTemplateUsed(response, 'wagtailadmin/pages/_privacy_indicator.html')
self.assertTemplateUsed(response, 'wagtailadmin/pages/_privacy_switch.html')
self.assertContains(response, '<div class="privacy-indicator private">')
self.assertNotContains(response, '<div class="privacy-indicator public">')
@ -228,7 +228,7 @@ class TestPrivacyIndicators(TestCase, WagtailTestUtils):
self.assertEqual(response.status_code, 200)
# Check the privacy indicator is public
self.assertTemplateUsed(response, 'wagtailadmin/pages/_privacy_indicator.html')
self.assertTemplateUsed(response, 'wagtailadmin/pages/_privacy_switch.html')
self.assertContains(response, '<div class="privacy-indicator public">')
self.assertNotContains(response, '<div class="privacy-indicator private">')
@ -242,7 +242,7 @@ class TestPrivacyIndicators(TestCase, WagtailTestUtils):
self.assertEqual(response.status_code, 200)
# Check the privacy indicator is public
self.assertTemplateUsed(response, 'wagtailadmin/pages/_privacy_indicator.html')
self.assertTemplateUsed(response, 'wagtailadmin/pages/_privacy_switch.html')
self.assertContains(response, '<div class="privacy-indicator private">')
self.assertNotContains(response, '<div class="privacy-indicator public">')
@ -256,6 +256,6 @@ class TestPrivacyIndicators(TestCase, WagtailTestUtils):
self.assertEqual(response.status_code, 200)
# Check the privacy indicator is public
self.assertTemplateUsed(response, 'wagtailadmin/pages/_privacy_indicator.html')
self.assertTemplateUsed(response, 'wagtailadmin/pages/_privacy_switch.html')
self.assertContains(response, '<div class="privacy-indicator private">')
self.assertNotContains(response, '<div class="privacy-indicator public">')