kopia lustrzana https://github.com/wagtail/wagtail
Eliminate template tags from privacy setting view JS
rodzic
206e186f57
commit
568928215e
|
@ -1,4 +1,4 @@
|
|||
function(modal) {
|
||||
modal.respond('setPermission', {% if is_public %}true{% else %}false{% endif %});
|
||||
function(modal, jsonData) {
|
||||
modal.respond('setPermission', jsonData['is_public']);
|
||||
modal.close();
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function(modal) {
|
||||
modal.respond('setPermission', {% if is_public %}true{% else %}false{% endif %});
|
||||
function(modal, jsonData) {
|
||||
modal.respond('setPermission', jsonData['is_public']);
|
||||
modal.close();
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ class TestSetPrivacyView(TestCase, WagtailTestUtils):
|
|||
|
||||
# Check response
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, "modal.respond('setPermission', false);")
|
||||
self.assertContains(response, '"is_public": false')
|
||||
|
||||
# Check that a page restriction has been created
|
||||
self.assertTrue(PageViewRestriction.objects.filter(page=self.public_page).exists())
|
||||
|
@ -154,7 +154,7 @@ class TestSetPrivacyView(TestCase, WagtailTestUtils):
|
|||
|
||||
# Check response
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, "modal.respond('setPermission', true);")
|
||||
self.assertContains(response, '"is_public": true')
|
||||
|
||||
# Check that the page restriction has been deleted
|
||||
self.assertFalse(PageViewRestriction.objects.filter(page=self.private_page).exists())
|
||||
|
@ -188,7 +188,7 @@ class TestSetPrivacyView(TestCase, WagtailTestUtils):
|
|||
|
||||
# Check response
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, "modal.respond('setPermission', false);")
|
||||
self.assertContains(response, '"is_public": false')
|
||||
|
||||
# Check that a page restriction has been created
|
||||
self.assertTrue(PageViewRestriction.objects.filter(page=self.public_page).exists())
|
||||
|
@ -237,7 +237,7 @@ class TestSetPrivacyView(TestCase, WagtailTestUtils):
|
|||
|
||||
# Check response
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, "modal.respond('setPermission', true);")
|
||||
self.assertContains(response, '"is_public": true')
|
||||
|
||||
# Check that the page restriction has been deleted
|
||||
self.assertFalse(PageViewRestriction.objects.filter(page=self.private_page).exists())
|
||||
|
|
|
@ -34,7 +34,8 @@ def set_privacy(request, collection_id):
|
|||
form.save()
|
||||
|
||||
return render_modal_workflow(
|
||||
request, None, 'wagtailadmin/collection_privacy/set_privacy_done.js', {
|
||||
request, None, 'wagtailadmin/collection_privacy/set_privacy_done.js',
|
||||
None, json_data={
|
||||
'is_public': (form.cleaned_data['restriction_type'] == 'none')
|
||||
}
|
||||
)
|
||||
|
|
|
@ -34,7 +34,8 @@ def set_privacy(request, page_id):
|
|||
form.save()
|
||||
|
||||
return render_modal_workflow(
|
||||
request, None, 'wagtailadmin/page_privacy/set_privacy_done.js', {
|
||||
request, None, 'wagtailadmin/page_privacy/set_privacy_done.js',
|
||||
None, json_data={
|
||||
'is_public': (form.cleaned_data['restriction_type'] == 'none')
|
||||
}
|
||||
)
|
||||
|
|
Ładowanie…
Reference in New Issue