Skip to content

Commit

Permalink
Use breadcrumbs for wagtail.locales views
Browse files Browse the repository at this point in the history
  • Loading branch information
laymonage authored and gasman committed Mar 12, 2024
1 parent 9fc53dc commit bed92e4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
21 changes: 18 additions & 3 deletions wagtail/locales/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ def test_simple(self):
response = self.get()
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "wagtailadmin/generic/index.html")
self.assertBreadcrumbsNotRendered(response.content)
self.assertBreadcrumbsItemsRendered(
[{"url": "", "label": "Locales"}],
response.content,
)


class TestLocaleCreateView(AdminTemplateTestUtils, WagtailTestUtils, TestCase):
Expand All @@ -43,7 +46,13 @@ def test_simple(self):
response = self.get()
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "wagtaillocales/create.html")
self.assertBreadcrumbsNotRendered(response.content)
self.assertBreadcrumbsItemsRendered(
[
{"label": "Locales", "url": "/admin/locales/"},
{"label": "New: Locale", "url": ""},
],
response.content,
)

self.assertEqual(
response.context["form"].fields["language_code"].choices, [("fr", "French")]
Expand Down Expand Up @@ -116,7 +125,13 @@ def test_simple(self):
response = self.get()
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "wagtaillocales/edit.html")
self.assertBreadcrumbsNotRendered(response.content)
self.assertBreadcrumbsItemsRendered(
[
{"url": "/admin/locales/", "label": "Locales"},
{"url": "", "label": str(self.english)},
],
response.content,
)

self.assertEqual(
response.context["form"].fields["language_code"].choices,
Expand Down
1 change: 0 additions & 1 deletion wagtail/locales/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ class LocaleViewSet(ModelViewSet):
model = Locale
permission_policy = locale_permission_policy
add_to_reference_index = False
_show_breadcrumbs = False

index_view_class = IndexView
add_view_class = CreateView
Expand Down

0 comments on commit bed92e4

Please sign in to comment.