Rename Snippets type_index.html and results.html templates to index.html and index_results.html

pull/10303/head
Sage Abdullah 2023-03-27 11:24:07 +01:00 zatwierdzone przez Matt Westcott
rodzic 1992c72791
commit b3a9c79f40
4 zmienionych plików z 11 dodań i 13 usunięć

Wyświetl plik

@ -25,7 +25,7 @@
<div class="nice-padding{% if filters %} filterable{% endif %}">
<div id="snippet-results" class="snippets">
{% include "wagtailsnippets/snippets/results.html" %}
{% include "wagtailsnippets/snippets/index_results.html" %}
</div>
{% if filters %}
{% include "wagtailadmin/shared/filters.html" %}

Wyświetl plik

@ -109,7 +109,7 @@ class TestSnippetListView(WagtailTestUtils, TestCase):
def test_simple(self):
response = self.get()
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "wagtailsnippets/snippets/type_index.html")
self.assertTemplateUsed(response, "wagtailsnippets/snippets/index.html")
self.assertEqual(response.context["header_icon"], "snippet")
def get_with_limited_permissions(self):
@ -140,9 +140,7 @@ class TestSnippetListView(WagtailTestUtils, TestCase):
for page in pages:
response = self.get({"p": page})
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(
response, "wagtailsnippets/snippets/type_index.html"
)
self.assertTemplateUsed(response, "wagtailsnippets/snippets/index.html")
def test_displays_add_button(self):
self.assertContains(self.get(), "Add advert")
@ -469,7 +467,7 @@ class TestSnippetListViewWithSearchableSnippet(WagtailTestUtils, TransactionTest
def test_simple(self):
response = self.get()
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "wagtailsnippets/snippets/type_index.html")
self.assertTemplateUsed(response, "wagtailsnippets/snippets/index.html")
# All snippets should be in items
items = list(response.context["page_obj"].object_list)
@ -483,7 +481,7 @@ class TestSnippetListViewWithSearchableSnippet(WagtailTestUtils, TransactionTest
def test_empty_q(self):
response = self.get({"q": ""})
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "wagtailsnippets/snippets/type_index.html")
self.assertTemplateUsed(response, "wagtailsnippets/snippets/index.html")
# All snippets should be in items
items = list(response.context["page_obj"].object_list)
@ -4562,7 +4560,7 @@ class TestAddOnlyPermissions(WagtailTestUtils, TestCase):
def test_get_index(self):
response = self.client.get(reverse("wagtailsnippets_tests_advert:list"))
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "wagtailsnippets/snippets/type_index.html")
self.assertTemplateUsed(response, "wagtailsnippets/snippets/index.html")
# user should get an "Add advert" button
self.assertContains(response, "Add advert")
@ -4616,7 +4614,7 @@ class TestEditOnlyPermissions(WagtailTestUtils, TestCase):
def test_get_index(self):
response = self.client.get(reverse("wagtailsnippets_tests_advert:list"))
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "wagtailsnippets/snippets/type_index.html")
self.assertTemplateUsed(response, "wagtailsnippets/snippets/index.html")
# user should not get an "Add advert" button
self.assertNotContains(response, "Add advert")
@ -4668,7 +4666,7 @@ class TestDeleteOnlyPermissions(WagtailTestUtils, TestCase):
def test_get_index(self):
response = self.client.get(reverse("wagtailsnippets_tests_advert:list"))
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "wagtailsnippets/snippets/type_index.html")
self.assertTemplateUsed(response, "wagtailsnippets/snippets/index.html")
# user should not get an "Add advert" button
self.assertNotContains(response, "Add advert")
@ -4861,7 +4859,7 @@ class TestSnippetListViewWithCustomPrimaryKey(WagtailTestUtils, TestCase):
def test_simple(self):
response = self.get()
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "wagtailsnippets/snippets/type_index.html")
self.assertTemplateUsed(response, "wagtailsnippets/snippets/index.html")
# All snippets should be in items
items = list(response.context["page_obj"].object_list)

Wyświetl plik

@ -188,9 +188,9 @@ class IndexView(generic.IndexViewOptionalFeaturesMixin, generic.IndexView):
def get_template_names(self):
if self.results_only:
return ["wagtailsnippets/snippets/results.html"]
return ["wagtailsnippets/snippets/index_results.html"]
else:
return ["wagtailsnippets/snippets/type_index.html"]
return ["wagtailsnippets/snippets/index.html"]
class CreateView(generic.CreateEditViewOptionalFeaturesMixin, generic.CreateView):