mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-03-16 22:10:28 +00:00
Add "Locked pages" view
This commit is contained in:
parent
ffd81242c3
commit
f09919a0f9
5 changed files with 56 additions and 0 deletions
|
|
@ -0,0 +1,21 @@
|
|||
{% extends "wagtailadmin/pages/listing/_list_explore.html" %}
|
||||
|
||||
{% load i18n wagtailadmin_tags %}
|
||||
|
||||
{% block page_navigation %}
|
||||
<td>
|
||||
{% page_permissions page as perms %}
|
||||
<p>
|
||||
Locked
|
||||
{% if page.locked_by %}by <b>{% if page.locked_by_id == request.user.pk %}you{% else %}{{ page.locked_by }}{% endif %}</b>{% endif %}
|
||||
{% if page.locked_at %}at <b>{{ page.locked_at|date:"d M Y H:i" }}</b>{% endif %}
|
||||
</p>
|
||||
{% if perms.can_unlock %}
|
||||
<form action="{% url 'wagtailadmin_pages:unlock' page.id %}" method="post">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="next" value="{{ request.path }}">
|
||||
<button type="submit" class="button button-secondary button-small">{% trans 'Unlock' %}</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endblock %}
|
||||
12
wagtail/admin/templates/wagtailadmin/pages/locked_pages.html
Normal file
12
wagtail/admin/templates/wagtailadmin/pages/locked_pages.html
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{% extends "wagtailadmin/base.html" %}
|
||||
{% load i18n %}
|
||||
{% block titletag %}{% trans "Locked pages" %}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% trans "Locked pages" as title %}
|
||||
{% include "wagtailadmin/shared/header.html" with title=title icon="doc-empty-inverse" %}
|
||||
|
||||
<div id="page-results">
|
||||
{% include "wagtailadmin/pages/locked_pages_results.html" %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
{% load i18n wagtailadmin_tags %}
|
||||
<div class="nice-padding">
|
||||
{% if pages %}
|
||||
{% include "wagtailadmin/pages/listing/_list_unlock.html" %}
|
||||
|
||||
{% url 'wagtailadmin_pages:locked_pages' as pagination_base_url %}
|
||||
{% paginate pages base_url=pagination_base_url %}
|
||||
{% else %}
|
||||
<p>{% trans 'No pages have been locked.' %}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
|
@ -33,6 +33,7 @@ urlpatterns = [
|
|||
|
||||
url(r'^(\d+)/lock/$', pages.lock, name='lock'),
|
||||
url(r'^(\d+)/unlock/$', pages.unlock, name='unlock'),
|
||||
url(r'^locked/$', pages.locked_pages, name='locked_pages'),
|
||||
|
||||
url(r'^(\d+)/revisions/$', pages.revisions_index, name='revisions_index'),
|
||||
url(r'^(\d+)/revisions/(\d+)/view/$', pages.revisions_view, name='revisions_view'),
|
||||
|
|
|
|||
|
|
@ -1280,3 +1280,14 @@ def revisions_unschedule(request, page_id, revision_id):
|
|||
'next': next_url,
|
||||
'subtitle': subtitle
|
||||
})
|
||||
|
||||
|
||||
def locked_pages(request):
|
||||
pages = UserPagePermissionsProxy(request.user).editable_pages().filter(locked=True)
|
||||
|
||||
paginator = Paginator(pages, per_page=10)
|
||||
pages = paginator.get_page(request.GET.get('p'))
|
||||
|
||||
return render(request, 'wagtailadmin/pages/locked_pages.html', {
|
||||
'pages': pages,
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue