Add customization for chapters
This commit is contained in:
parent
6dc7829862
commit
6e2ba52dea
|
|
@ -1,124 +0,0 @@
|
|||
{# This template is overwritten to create a custom cms ui for the model "chapter" to improve navigation experience.#}
|
||||
{# See MS-538#}
|
||||
|
||||
{% load i18n %}
|
||||
{% load l10n %}
|
||||
{% load wagtailadmin_tags %}
|
||||
<table class="listing {% if full_width %}full-width{% endif %} {% block table_classname %}{% endblock %}">
|
||||
{% 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 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 show_ordering_column or show_bulk_actions %} 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:"DATETIME_FORMAT" }}">
|
||||
{% blocktrans with time_period=parent_page.latest_revision_created_at|timesince %}{{ time_period }}
|
||||
ago{% endblocktrans %}</div>{% endif %}</td>
|
||||
<td class="type" valign="bottom">
|
||||
{% if not parent_page.is_root %}
|
||||
{{ parent_page.content_type.model_class.get_verbose_name }}
|
||||
{% endif %}
|
||||
</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 %}
|
||||
{% 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 icon icon-grip text-replace">{% trans 'Drag' %}</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 %}
|
||||
{% endblock %}
|
||||
{% if page.content_type.model == 'chapter' %}
|
||||
<div style="margin-top:10px; padding-left: 30px">
|
||||
<ul>
|
||||
{% for c in page.get_children %}
|
||||
{% if not c.specific.user_created and not c.specific.contentblocksnapshot %}
|
||||
<li>
|
||||
{% if page_perms.can_edit %}
|
||||
<a href="{% url 'wagtailadmin_pages:edit' c.id %}"
|
||||
title="{% trans 'Edit this page' %}"> {{ c.get_admin_display_title }}
|
||||
</a>
|
||||
{% else %}
|
||||
{{ c.get_admin_display_title }}
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
</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 %}
|
||||
<div class="human-readable-date"
|
||||
title="{{ page.latest_revision_created_at|date:"DATETIME_FORMAT" }}">
|
||||
{% blocktrans with time_period=page.latest_revision_created_at|timesince %}{{ time_period }}
|
||||
ago{% endblocktrans %}</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>
|
||||
|
|
@ -5,7 +5,8 @@
|
|||
<div class="title-wrapper">
|
||||
{% if page.is_site_root %}
|
||||
{% if perms.wagtailcore.add_site or perms.wagtailcore.change_site or perms.wagtailcore.delete_site %}
|
||||
<a href="{% url 'wagtailsites:index' %}" title="{% trans 'Sites menu' %}">{% icon name="site" classname="initial" %}</a>
|
||||
<a href="{% url 'wagtailsites:index' %}" title="{% trans 'Sites menu' %}">{% icon name="site" classname="initial"
|
||||
%}</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
|
|
@ -23,6 +24,9 @@
|
|||
{% status page.locale.get_display_name classname="w-status--label" %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
|
||||
{% include "wagtailadmin/pages/listing/_privacy_indicator.html" with page=page %}
|
||||
{% include "wagtailadmin/pages/listing/_locked_indicator.html" with page=page %}
|
||||
</div>
|
||||
|
|
@ -30,3 +34,27 @@
|
|||
<ul class="actions">
|
||||
{% page_listing_buttons page request.user next_url=actions_next_url %}
|
||||
</ul>
|
||||
|
||||
|
||||
<!--Here starts the customization part. -->
|
||||
<!--Commit: 3c5c9422353964aa25cdd04b296859f71c4c1a34-->
|
||||
{% if page.content_type.model == 'chapter' %}
|
||||
<div style="margin-top:10px; padding-left: 30px">
|
||||
<ul>
|
||||
{% for c in page.get_children %}
|
||||
{% if not c.specific.user_created and not c.specific.contentblocksnapshot %}
|
||||
<li>
|
||||
{% if page_perms.can_edit %}
|
||||
<a href="{% url 'wagtailadmin_pages:edit' c.id %}"
|
||||
title="{% trans 'Edit this page' %}"> {{ c.get_admin_display_title }}
|
||||
</a>
|
||||
{% else %}
|
||||
{{ c.get_admin_display_title }}
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
|
|||
Loading…
Reference in New Issue