From b882f0d28164811499c50f2d04092d5d63eea36f Mon Sep 17 00:00:00 2001 From: Matt Westcott Date: Tue, 4 Oct 2022 16:39:52 +0100 Subject: [PATCH] Move snippet usage link to sidebar --- wagtail/snippets/side_panels.py | 5 +++++ .../wagtailsnippets/side_panels/usage.html | 17 +++++++++++++++++ .../wagtailsnippets/snippets/edit.html | 9 --------- 3 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 wagtail/snippets/templates/wagtailsnippets/side_panels/usage.html diff --git a/wagtail/snippets/side_panels.py b/wagtail/snippets/side_panels.py index 31e9f1adc9..ea7bdc4156 100644 --- a/wagtail/snippets/side_panels.py +++ b/wagtail/snippets/side_panels.py @@ -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 = [ diff --git a/wagtail/snippets/templates/wagtailsnippets/side_panels/usage.html b/wagtail/snippets/templates/wagtailsnippets/side_panels/usage.html new file mode 100644 index 0000000000..2d6710e858 --- /dev/null +++ b/wagtail/snippets/templates/wagtailsnippets/side_panels/usage.html @@ -0,0 +1,17 @@ +{% load i18n %} +
+
+ +
+
diff --git a/wagtail/snippets/templates/wagtailsnippets/snippets/edit.html b/wagtail/snippets/templates/wagtailsnippets/snippets/edit.html index 70cd81cc85..84e276b4c6 100644 --- a/wagtail/snippets/templates/wagtailsnippets/snippets/edit.html +++ b/wagtail/snippets/templates/wagtailsnippets/snippets/edit.html @@ -30,15 +30,6 @@ - -
-
-
{% trans "Usage" %}
-
- {% blocktrans trimmed count usage_count=object.get_usage.count %}Used {{ usage_count }} time{% plural %}Used {{ usage_count }} times{% endblocktrans %} -
-
-
{% endblock %}