diff --git a/app/misc/migrations/0008_codeofconductpage.py b/app/misc/migrations/0008_codeofconductpage.py new file mode 100644 index 0000000..f2517ab --- /dev/null +++ b/app/misc/migrations/0008_codeofconductpage.py @@ -0,0 +1,39 @@ +# Generated by Django 4.2.7 on 2024-07-31 21:16 + +from django.db import migrations, models +import django.db.models.deletion +import wagtail.blocks +import wagtail.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('wagtailcore', '0089_log_entry_data_json_null_to_object'), + ('misc', '0007_alter_dataprinciplespage_footer_button_text'), + ] + + operations = [ + migrations.CreateModel( + name='CodeOfConductPage', + fields=[ + ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')), + ('intro', wagtail.fields.RichTextField(blank=True)), + ('short_version_title', models.CharField(default='Short Version')), + ('short_version_body', wagtail.fields.RichTextField(blank=True)), + ('full_version_title', models.CharField(default='Full Version')), + ('full_version_body', wagtail.fields.RichTextField(blank=True)), + ('complaint_handling_title', models.CharField(default='Complaint Handling Process')), + ('complaint_handling_body', wagtail.fields.RichTextField(blank=True)), + ('our_policies_title', models.CharField(default='Our Policies')), + ('our_policies_links', wagtail.fields.StreamField([('blocks', wagtail.blocks.StructBlock([('text', wagtail.blocks.CharBlock()), ('link', wagtail.blocks.StreamBlock([('page', wagtail.blocks.PageChooserBlock()), ('url', wagtail.blocks.URLBlock())]))]))], blank=True, help_text='Links to be shown under the Our Policies section.', null=True, use_json_field=True)), + ('question_block_title', models.CharField(default='Have a question about the code of conduct?')), + ('question_block_button_text', models.CharField(default='Contact Community Working Group')), + ('question_block_button_link', wagtail.fields.StreamField([('page', wagtail.blocks.PageChooserBlock()), ('url', wagtail.blocks.URLBlock())], blank=True, use_json_field=True)), + ], + options={ + 'abstract': False, + }, + bases=('wagtailcore.page',), + ), + ] diff --git a/app/misc/migrations/0009_privacypolicypage.py b/app/misc/migrations/0009_privacypolicypage.py new file mode 100644 index 0000000..7be9bf1 --- /dev/null +++ b/app/misc/migrations/0009_privacypolicypage.py @@ -0,0 +1,34 @@ +# Generated by Django 4.2.7 on 2024-08-01 16:35 + +from django.db import migrations, models +import django.db.models.deletion +import wagtail.blocks +import wagtail.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('wagtailcore', '0089_log_entry_data_json_null_to_object'), + ('misc', '0008_codeofconductpage'), + ] + + operations = [ + migrations.CreateModel( + name='PrivacyPolicyPage', + fields=[ + ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')), + ('intro', wagtail.fields.RichTextField(blank=True)), + ('body_text', wagtail.fields.RichTextField(blank=True)), + ('our_policies_title', models.CharField(default='Our Policies')), + ('our_policies_links', wagtail.fields.StreamField([('blocks', wagtail.blocks.StructBlock([('text', wagtail.blocks.CharBlock()), ('link', wagtail.blocks.StreamBlock([('page', wagtail.blocks.PageChooserBlock()), ('url', wagtail.blocks.URLBlock())]))]))], blank=True, help_text='Links to be shown under the Our Policies section.', null=True, use_json_field=True)), + ('question_block_title', models.CharField(default='Have a question about the code of conduct?')), + ('question_block_button_text', models.CharField(default='Contact Community Working Group')), + ('question_block_button_link', wagtail.fields.StreamField([('page', wagtail.blocks.PageChooserBlock()), ('url', wagtail.blocks.URLBlock())], blank=True, use_json_field=True)), + ], + options={ + 'abstract': False, + }, + bases=('wagtailcore.page',), + ), + ] diff --git a/app/misc/migrations/0010_alter_privacypolicypage_question_block_button_text_and_more.py b/app/misc/migrations/0010_alter_privacypolicypage_question_block_button_text_and_more.py new file mode 100644 index 0000000..918f7ae --- /dev/null +++ b/app/misc/migrations/0010_alter_privacypolicypage_question_block_button_text_and_more.py @@ -0,0 +1,23 @@ +# Generated by Django 4.2.7 on 2024-08-01 16:48 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('misc', '0009_privacypolicypage'), + ] + + operations = [ + migrations.AlterField( + model_name='privacypolicypage', + name='question_block_button_text', + field=models.CharField(default='Contact HOT'), + ), + migrations.AlterField( + model_name='privacypolicypage', + name='question_block_title', + field=models.CharField(default='Have a question about the privacy policy?'), + ), + ] diff --git a/app/misc/migrations/0011_rename_body_text_privacypolicypage_brief_body_text_and_more.py b/app/misc/migrations/0011_rename_body_text_privacypolicypage_brief_body_text_and_more.py new file mode 100644 index 0000000..3f67e18 --- /dev/null +++ b/app/misc/migrations/0011_rename_body_text_privacypolicypage_brief_body_text_and_more.py @@ -0,0 +1,30 @@ +# Generated by Django 4.2.7 on 2024-08-01 18:58 + +from django.db import migrations, models +import wagtail.blocks +import wagtail.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('misc', '0010_alter_privacypolicypage_question_block_button_text_and_more'), + ] + + operations = [ + migrations.RenameField( + model_name='privacypolicypage', + old_name='body_text', + new_name='brief_body_text', + ), + migrations.AddField( + model_name='privacypolicypage', + name='body_sections', + field=wagtail.fields.StreamField([('blocks', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('body', wagtail.blocks.RichTextBlock())]))], blank=True, help_text='Sections to be shown in the body following the table of contents; these sections will automatically populate the table of contents.', null=True, use_json_field=True), + ), + migrations.AddField( + model_name='privacypolicypage', + name='table_of_contents_title', + field=models.CharField(default='This Privacy Policy Contains the Following Sections:'), + ), + ] diff --git a/app/misc/models.py b/app/misc/models.py index c895d6e..86ca5a6 100644 --- a/app/misc/models.py +++ b/app/misc/models.py @@ -8,6 +8,94 @@ from app.core.models import LinkOrPageBlock +class CodeOfConductPage(Page): + max_count = 1 + + intro = RichTextField(blank=True) + + short_version_title = models.CharField(default="Short Version") + short_version_body = RichTextField(blank=True) + + full_version_title = models.CharField(default="Full Version") + full_version_body = RichTextField(blank=True) + + complaint_handling_title = models.CharField(default="Complaint Handling Process") + complaint_handling_body = RichTextField(blank=True) + + our_policies_title = models.CharField(default="Our Policies") + our_policies_links = StreamField([ + ('blocks', StructBlock([ + ('text', CharBlock()), + ('link', LinkOrPageBlock()) + ])) + ], use_json_field=True, null=True, blank=True, help_text="Links to be shown under the Our Policies section.") + + question_block_title = models.CharField(default="Have a question about the code of conduct?") + question_block_button_text = models.CharField(default="Contact Community Working Group") + question_block_button_link = StreamField(LinkOrPageBlock(), use_json_field=True, blank=True) + + content_panels = Page.content_panels + [ + MultiFieldPanel([ + FieldPanel('intro'), + FieldPanel('short_version_title'), + FieldPanel('short_version_body'), + FieldPanel('full_version_title'), + FieldPanel('full_version_body'), + FieldPanel('complaint_handling_title'), + FieldPanel('complaint_handling_body'), + ], heading="Body"), + MultiFieldPanel([ + FieldPanel('our_policies_title'), + FieldPanel('our_policies_links'), + FieldPanel('question_block_title'), + FieldPanel('question_block_button_text'), + FieldPanel('question_block_button_link'), + ], heading="Sidebar"), + ] + + +class PrivacyPolicyPage(Page): + max_count = 1 + + intro = RichTextField(blank=True) + brief_body_text = RichTextField(blank=True) + table_of_contents_title = models.CharField(default="This Privacy Policy Contains the Following Sections:") + body_sections = StreamField([ + ('blocks', StructBlock([ + ('title', CharBlock()), + ('body', RichTextBlock()) + ])) + ], use_json_field=True, null=True, blank=True, help_text="Sections to be shown in the body following the table of contents; these sections will automatically populate the table of contents.") + + our_policies_title = models.CharField(default="Our Policies") + our_policies_links = StreamField([ + ('blocks', StructBlock([ + ('text', CharBlock()), + ('link', LinkOrPageBlock()) + ])) + ], use_json_field=True, null=True, blank=True, help_text="Links to be shown under the Our Policies section.") + + question_block_title = models.CharField(default="Have a question about the privacy policy?") + question_block_button_text = models.CharField(default="Contact HOT") + question_block_button_link = StreamField(LinkOrPageBlock(), use_json_field=True, blank=True) + + content_panels = Page.content_panels + [ + MultiFieldPanel([ + FieldPanel('intro'), + FieldPanel('brief_body_text'), + FieldPanel('table_of_contents_title'), + FieldPanel('body_sections'), + ], heading="Body"), + MultiFieldPanel([ + FieldPanel('our_policies_title'), + FieldPanel('our_policies_links'), + FieldPanel('question_block_title'), + FieldPanel('question_block_button_text'), + FieldPanel('question_block_button_link'), + ], heading="Sidebar"), + ] + + class JoinOurConversationPage(Page): max_count = 1 diff --git a/app/misc/templates/misc/code_of_conduct_page.html b/app/misc/templates/misc/code_of_conduct_page.html new file mode 100644 index 0000000..fe91ddc --- /dev/null +++ b/app/misc/templates/misc/code_of_conduct_page.html @@ -0,0 +1,70 @@ +{% extends "base.html" %} +{% load static %} +{% load wagtailcore_tags %} +{% load wagtailimages_tags %} +{% load compress %} +{% block body_class %}template-dataprinciplespage{% endblock %} +{% block extra_css %} + {% compress css %} + {% endcompress css %} +{% endblock extra_css %} + +{% block content %} +
+
+
+
+

+ {{page.title}} +

+
+ {{page.intro|safe}} +
+ +

+ {{page.short_version_title}} +

+
+ {{page.short_version_body|safe}} +
+ +

+ {{page.full_version_title}} +

+
+ {{page.full_version_body|safe}} +
+ +

+ {{page.complaint_handling_title}} +

+
+ {{page.complaint_handling_body|safe}} +
+
+ +
+

+ {{page.our_policies_title}} +

+
+ {% for policy in page.our_policies_links %} +

+ {% include "ui/components/BaseLink.html" with linktext=policy.value.text linkurl=policy.value.link %} +

+ {% endfor %} +
+ + +
+
+
+
+{% endblock %} \ No newline at end of file diff --git a/app/misc/templates/misc/privacy_policy_page.html b/app/misc/templates/misc/privacy_policy_page.html new file mode 100644 index 0000000..dc01071 --- /dev/null +++ b/app/misc/templates/misc/privacy_policy_page.html @@ -0,0 +1,73 @@ +{% extends "base.html" %} +{% load static %} +{% load wagtailcore_tags %} +{% load wagtailimages_tags %} +{% load compress %} +{% block body_class %}template-dataprinciplespage{% endblock %} +{% block extra_css %} + {% compress css %} + {% endcompress css %} +{% endblock extra_css %} + +{% block content %} +
+
+
+
+

+ {{page.title}} +

+
+ {{page.intro|safe}} +
+ +
+ {{page.brief_body_text|safe}} + +

+ {{page.table_of_contents_title}} +

+
    + {% for section in page.body_sections %} + +
  1. + {{section.value.title}} +
  2. +
    + {% endfor %} +
+ + {% for section in page.body_sections %} +

+ {{forloop.counter}}. {{section.value.title}} +

+ {{section.value.body|safe}} + {% endfor %} +
+
+ +
+

+ {{page.our_policies_title}} +

+
+ {% for policy in page.our_policies_links %} +

+ {% include "ui/components/BaseLink.html" with linktext=policy.value.text linkurl=policy.value.link %} +

+ {% endfor %} +
+ + +
+
+
+
+{% endblock %} \ No newline at end of file