kopia lustrzana https://github.com/wagtail/wagtail
Change 'used' -> 'referenced'
rodzic
d7cad89b4d
commit
aaa723a14d
|
@ -10,7 +10,11 @@
|
|||
<a class="w-text-14 w-text-secondary hover:w-text-secondary-600 w-no-underline w-transition"
|
||||
href="{{ usage_url }}"
|
||||
>
|
||||
{% blocktrans trimmed count usage_count=usage_count %}Used {{ usage_count }} time{% plural %}Used {{ usage_count }} times{% endblocktrans %}
|
||||
{% if usage_url_text %}
|
||||
{{ usage_url_text }}
|
||||
{% else %}
|
||||
{% blocktrans trimmed count usage_count=usage_count %}Used {{ usage_count }} time{% plural %}Used {{ usage_count }} times{% endblocktrans %}
|
||||
{% endif %}
|
||||
</a>
|
||||
</div>
|
||||
</section>
|
||||
|
|
|
@ -158,7 +158,7 @@ class TestPageEdit(WagtailTestUtils, TestCase):
|
|||
self.assertNotContains(response, "data-form-side-explorer")
|
||||
|
||||
# test that usage info is shown
|
||||
self.assertContains(response, "Used 0 times")
|
||||
self.assertContains(response, "Referenced 0 times")
|
||||
self.assertContains(
|
||||
response, reverse("wagtailadmin_pages:usage", args=(self.event_page.id,))
|
||||
)
|
||||
|
@ -177,7 +177,7 @@ class TestPageEdit(WagtailTestUtils, TestCase):
|
|||
)
|
||||
|
||||
# test that usage info is shown
|
||||
self.assertContains(response, "Used 1 time")
|
||||
self.assertContains(response, "Referenced 1 time")
|
||||
self.assertContains(
|
||||
response, reverse("wagtailadmin_pages:usage", args=(self.event_page.id,))
|
||||
)
|
||||
|
|
|
@ -3,7 +3,7 @@ from django.forms import Media
|
|||
from django.urls import reverse
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.text import capfirst
|
||||
from django.utils.translation import gettext_lazy
|
||||
from django.utils.translation import gettext_lazy, ngettext
|
||||
|
||||
from wagtail.admin.ui.components import Component
|
||||
from wagtail.locks import BasicLock
|
||||
|
@ -192,6 +192,18 @@ class PageStatusSidePanel(BaseStatusSidePanel):
|
|||
)
|
||||
return templates
|
||||
|
||||
def get_usage_context(self):
|
||||
context = super().get_usage_context()
|
||||
context["usage_url"] = reverse(
|
||||
"wagtailadmin_pages:usage", args=(self.object.id,)
|
||||
)
|
||||
context["usage_url_text"] = ngettext(
|
||||
"Referenced %(count)s time",
|
||||
"Referenced %(count)s times",
|
||||
context["usage_count"],
|
||||
) % {"count": context["usage_count"]}
|
||||
return context
|
||||
|
||||
def get_context_data(self, parent_context):
|
||||
context = super().get_context_data(parent_context)
|
||||
user_perms = UserPagePermissionsProxy(self.request.user)
|
||||
|
@ -209,7 +221,6 @@ class PageStatusSidePanel(BaseStatusSidePanel):
|
|||
"workflow_history_url": reverse(
|
||||
"wagtailadmin_pages:workflow_history", args=(page.id,)
|
||||
),
|
||||
"usage_url": reverse("wagtailadmin_pages:usage", args=(page.id,)),
|
||||
"revisions_compare_url_name": "wagtailadmin_pages:revisions_compare",
|
||||
"lock_url": reverse("wagtailadmin_pages:lock", args=(page.id,)),
|
||||
"unlock_url": reverse("wagtailadmin_pages:unlock", args=(page.id,)),
|
||||
|
|
Ładowanie…
Reference in New Issue