0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

Move snippet usage link to sidebar

This commit is contained in:
Matt Westcott 2022-10-04 16:39:52 +01:00
parent be72dc5e96
commit b882f0d281
3 changed files with 22 additions and 9 deletions

View File

@ -10,6 +10,11 @@ from wagtail.models import PreviewableMixin
class SnippetStatusSidePanel(BaseStatusSidePanel):
def get_status_templates(self, context):
templates = super().get_status_templates(context)
templates.append("wagtailsnippets/side_panels/usage.html")
return templates
def get_context_data(self, parent_context):
context = super().get_context_data(parent_context)
inherit = [

View File

@ -0,0 +1,17 @@
{% load i18n %}
<div class="w-py-6 w-space-y-3">
<section class="w-flex w-space-x-3">
<div class="w-flex w-flex-1">
<div class="w-flex w-flex-col w-flex-1 w-pr-5">
<h3 class="w-label-1 !w-mt-0 w-mb-1">
{% trans "Usage" %}
</h3>
</div>
<a class="w-text-14 w-text-secondary hover:w-text-secondary-600 w-no-underline w-transition"
href="{{ object.usage_url }}"
>
{% blocktrans trimmed count usage_count=object.get_usage.count %}Used {{ usage_count }} time{% plural %}Used {{ usage_count }} times{% endblocktrans %}
</a>
</div>
</section>
</div>

View File

@ -30,15 +30,6 @@
</footer>
</form>
</div>
<div class="col2 ">
<dl>
<dt>{% trans "Usage" %}</dt>
<dd>
<a href="{{ object.usage_url }}">{% blocktrans trimmed count usage_count=object.get_usage.count %}Used {{ usage_count }} time{% plural %}Used {{ usage_count }} times{% endblocktrans %}</a>
</dd>
</dl>
</div>
</div>
{% endblock %}