From b2751364b1f6d76a91206e695a883f5c9cb9212b Mon Sep 17 00:00:00 2001 From: luminaryFlowers <71102109+luminaryFlowers@users.noreply.github.com> Date: Thu, 1 Aug 2024 12:43:28 -0700 Subject: [PATCH] privacy policy and code of conduct pages --- app/misc/migrations/0008_codeofconductpage.py | 39 ++++++++ app/misc/migrations/0009_privacypolicypage.py | 34 +++++++ ...age_question_block_button_text_and_more.py | 23 +++++ ...vacypolicypage_brief_body_text_and_more.py | 30 +++++++ app/misc/models.py | 88 +++++++++++++++++++ .../templates/misc/code_of_conduct_page.html | 70 +++++++++++++++ .../templates/misc/privacy_policy_page.html | 73 +++++++++++++++ 7 files changed, 357 insertions(+) create mode 100644 app/misc/migrations/0008_codeofconductpage.py create mode 100644 app/misc/migrations/0009_privacypolicypage.py create mode 100644 app/misc/migrations/0010_alter_privacypolicypage_question_block_button_text_and_more.py create mode 100644 app/misc/migrations/0011_rename_body_text_privacypolicypage_brief_body_text_and_more.py create mode 100644 app/misc/templates/misc/code_of_conduct_page.html create mode 100644 app/misc/templates/misc/privacy_policy_page.html 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 %} +
+ {% include "ui/components/BaseLink.html" with linktext=policy.value.text linkurl=policy.value.link %} +
+ {% endfor %} ++ {% include "ui/components/BaseLink.html" with linktext=policy.value.text linkurl=policy.value.link %} +
+ {% endfor %} +