Rename reshow_upload_form step on document chooser to reshow_creation_form

We'll standardise on this name, since not all creation forms involve uploads.
pull/8555/head
Matt Westcott 2022-05-20 14:42:28 +01:00 zatwierdzone przez LB (Ben Johnston)
rodzic 34f646c611
commit a67fd85fcf
4 zmienionych plików z 4 dodań i 4 usunięć

Wyświetl plik

@ -27,5 +27,4 @@ window.DOCUMENT_CHOOSER_MODAL_ONLOAD_HANDLERS =
creationFormFileFieldSelector: '#id_document-chooser-upload-file',
creationFormTitleFieldSelector: '#id_document-chooser-upload-title',
creationFormEventName: 'wagtail:documents-upload',
reshowCreationFormStepName: 'reshow_upload_form',
}).getOnLoadHandlers();

Wyświetl plik

@ -199,6 +199,7 @@ class ChooserModalOnloadHandlerFactory {
if (this.modalHasTabs(modal)) initTabs();
}
// eslint-disable-next-line class-methods-use-this
modalHasTabs(modal) {
return $('[data-tabs]', modal.body).length;
}

Wyświetl plik

@ -1588,7 +1588,7 @@ class TestDocumentChooserUploadView(TestCase, WagtailTestUtils):
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "wagtaildocs/chooser/upload_form.html")
response_json = json.loads(response.content.decode())
self.assertEqual(response_json["step"], "reshow_upload_form")
self.assertEqual(response_json["step"], "reshow_creation_form")
def test_post(self):
# Build a fake file
@ -1670,7 +1670,7 @@ class TestDocumentChooserUploadViewWithLimitedPermissions(TestCase, WagtailTestU
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "wagtaildocs/chooser/upload_form.html")
response_json = json.loads(response.content.decode())
self.assertEqual(response_json["step"], "reshow_upload_form")
self.assertEqual(response_json["step"], "reshow_creation_form")
# user only has access to one collection -> should not see the collections field
self.assertNotIn("id_collection", response_json["htmlFragment"])

Wyświetl plik

@ -199,7 +199,7 @@ def chooser_upload(request):
None,
None,
json_data={
"step": "reshow_upload_form",
"step": "reshow_creation_form",
"htmlFragment": render_to_string(
"wagtaildocs/chooser/upload_form.html", {"form": form}, request
),