Move Usage info (Documents, Images) to sidebar

pull/3976/head
Kees Hink 2017-10-19 14:12:34 +01:00 zatwierdzone przez Karl Hobley
rodzic 57969731b2
commit 454af89c17
5 zmienionych plików z 66 dodań i 34 usunięć

Wyświetl plik

@ -394,9 +394,13 @@ Usage for images, documents and snippets
WAGTAIL_USAGE_COUNT_ENABLED = True
When enabled Wagtail shows where a particular image, document or snippet is being used on your site (disabled by default). A link will appear on the edit page showing you which pages they have been used on.
When enabled Wagtail shows where a particular image, document or snippet is being used on your site.
This is disabled by default because it generates a query which may run slowly on sites with large numbers of pages.
This link is also shown on the delete page, above the "Delete" button.
A link will appear on the edit page (in the rightmost column) showing you how many times the item is used.
Clicking this link takes you to the "Usage" page, which shows you where the snippet, document or image is used.
The link is also shown on the delete page, above the "Delete" button.
.. note::

Wyświetl plik

@ -1,4 +1,4 @@
{% load i18n wagtailadmin_tags %}
{% load i18n %}
{% comment %}
Variables accepted by this template:
@ -36,12 +36,6 @@
{% endif %}
</div>
<div class="right">
{% usage_count_enabled as uc_enabled %}
{% if uc_enabled and usage_object %}
<div class="usagecount">
<a href="{{ usage_object.usage_url }}">{% blocktrans count usage_count=usage_object.get_usage.count %}Used {{ usage_count }} time{% plural %}Used {{ usage_count }} times{% endblocktrans %}</a>
</div>
{% endif %}
{% if add_link %}
<div class="addbutton">
<a href="{% url add_link %}" class="button bicolor icon icon-plus">{{ add_text }}</a>

Wyświetl plik

@ -1,6 +1,6 @@
{% extends "wagtailadmin/base.html" %}
{% load i18n %}
{% load wagtailimages_tags %}
{% load wagtailimages_tags wagtailadmin_tags %}
{% block titletag %}{% blocktrans with title=document.title %}Editing {{ title }}{% endblocktrans %}{% endblock %}
{% block extra_js %}
@ -18,7 +18,7 @@
{% block content %}
{% trans "Editing" as editing_str %}
{% include "wagtailadmin/shared/header.html" with title=editing_str subtitle=document.title icon="doc-full-inverse" usage_object=document %}
{% include "wagtailadmin/shared/header.html" with title=editing_str subtitle=document.title icon="doc-full-inverse" %}
<div class="row row-flush nice-padding">
@ -50,6 +50,14 @@
<dt>{% trans "Filesize" %}</dt>
<dd>{% if filesize %}{{ filesize|filesizeformat }}{% else %}{% trans "File not found" %}{% endif %}</dd>
{% endif %}
{% usage_count_enabled as uc_enabled %}
{% if uc_enabled %}
<dt>{% trans "Usage" %}</dt>
<dd>
<a href="{{ image.usage_url }}">{% blocktrans count usage_count=document.get_usage.count %}Used {{ usage_count }} time{% plural %}Used {{ usage_count }} times{% endblocktrans %}</a>
</dd>
{% endif %}
</dl>
</div>
</div>

Wyświetl plik

@ -1,5 +1,5 @@
{% extends "wagtailadmin/base.html" %}
{% load wagtailimages_tags staticfiles i18n l10n %}
{% load wagtailimages_tags wagtailadmin_tags staticfiles i18n l10n %}
{% block titletag %}{% blocktrans with title=image.title %}Editing image {{ title }}{% endblocktrans %}{% endblock %}
{% block extra_css %}
{{ block.super }}
@ -29,7 +29,7 @@
{% block content %}
{% trans "Editing" as editing_str %}
{% include "wagtailadmin/shared/header.html" with title=editing_str subtitle=image.title icon="image" usage_object=image %}
{% include "wagtailadmin/shared/header.html" with title=editing_str subtitle=image.title icon="image" %}
<div class="row row-flush nice-padding">
@ -92,6 +92,14 @@
<dd>{{ original_image.width }}x{{ original_image.height }}</dd>
<dt>{% trans "Filesize" %}</dt>
<dd>{% if filesize %}{{ filesize|filesizeformat }}{% else %}{% trans "File not found" %}{% endif %}</dd>
{% usage_count_enabled as uc_enabled %}
{% if uc_enabled %}
<dt>{% trans "Usage" %}</dt>
<dd>
<a href="{{ image.usage_url }}">{% blocktrans count usage_count=image.get_usage.count %}Used {{ usage_count }} time{% plural %}Used {{ usage_count }} times{% endblocktrans %}</a>
</dd>
{% endif %}
</dl>
</div>
</div>

Wyświetl plik

@ -1,30 +1,48 @@
{% extends "wagtailadmin/base.html" %}
{% load i18n %}
{% load wagtailadmin_tags i18n %}
{% block titletag %}{% blocktrans with snippet_type_name=model_opts.verbose_name %}Editing {{ snippet_type_name }} - {{ instance }}{% endblocktrans %}{% endblock %}
{% block content %}
{% trans "Editing" as editing_str %}
{% include "wagtailadmin/shared/header.html" with title=editing_str subtitle=instance icon="snippet" usage_object=instance tabbed=1 merged=1 %}
{% include "wagtailadmin/shared/header.html" with title=editing_str subtitle=instance icon="snippet" tabbed=1 %}
<form action="{% url 'wagtailsnippets:edit' model_opts.app_label model_opts.model_name instance.id %}" method="POST" novalidate{% if form.is_multipart %} enctype="multipart/form-data"{% endif %}>
{% csrf_token %}
{{ edit_handler.render_form_content }}
<div class="row row-flush nice-padding">
<footer>
<ul>
<li class="actions">
<div class="dropdown dropup dropdown-button match-width">
<button type="submit" class="button action-save button-longrunning" tabindex="3" data-clicked-text="{% trans 'Saving...' %}" {% if page.locked %}disabled {% endif %}>
<span class="icon icon-spinner"></span><em>{% trans 'Save' %}</em>
</button>
<div class="dropdown-toggle icon icon-arrow-up"></div>
<ul role="menu">
<li><a href="{% url 'wagtailsnippets:delete' model_opts.app_label model_opts.model_name instance.id %}" class="shortcut">{% trans "Delete" %}</a></li>
</ul>
</div>
</li>
</ul>
</footer>
</form>
<div class="col10 divider-after">
<form action="{% url 'wagtailsnippets:edit' model_opts.app_label model_opts.model_name instance.id %}" method="POST" novalidate{% if form.is_multipart %} enctype="multipart/form-data"{% endif %}>
{% csrf_token %}
{{ edit_handler.render_form_content }}
</form>
</div>
<div class="col2 ">
<dl>
{% usage_count_enabled as uc_enabled %}
{% if uc_enabled %}
<dt>{% trans "Usage" %}</dt>
<dd>
<a href="{{ instance.usage_url }}">{% blocktrans count usage_count=instance.get_usage.count %}Used {{ usage_count }} time{% plural %}Used {{ usage_count }} times{% endblocktrans %}</a>
</dd>
{% endif %}
</dl>
</div>
</div>
<footer>
<ul>
<li class="actions">
<div class="dropdown dropup dropdown-button match-width">
<button type="submit" class="button action-save button-longrunning" tabindex="3" data-clicked-text="{% trans 'Saving...' %}" {% if page.locked %}disabled {% endif %}>
<span class="icon icon-spinner"></span><em>{% trans 'Save' %}</em>
</button>
<div class="dropdown-toggle icon icon-arrow-up"></div>
<ul role="menu">
<li><a href="{% url 'wagtailsnippets:delete' model_opts.app_label model_opts.model_name instance.id %}" class="shortcut">{% trans "Delete" %}</a></li>
</ul>
</div>
</li>
</ul>
</footer>
{% endblock %}