Skip to content

Commit

Permalink
Merge pull request #36 from hotosm/feat/code-of-conduct-privacy-policy
Browse files Browse the repository at this point in the history
privacy policy and code of conduct pages
  • Loading branch information
luminaryFlowers authored Aug 1, 2024
2 parents 508c223 + b275136 commit 5cf2942
Show file tree
Hide file tree
Showing 7 changed files with 357 additions and 0 deletions.
39 changes: 39 additions & 0 deletions app/misc/migrations/0008_codeofconductpage.py
Original file line number Diff line number Diff line change
@@ -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',),
),
]
34 changes: 34 additions & 0 deletions app/misc/migrations/0009_privacypolicypage.py
Original file line number Diff line number Diff line change
@@ -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',),
),
]
Original file line number Diff line number Diff line change
@@ -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?'),
),
]
Original file line number Diff line number Diff line change
@@ -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:'),
),
]
88 changes: 88 additions & 0 deletions app/misc/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
70 changes: 70 additions & 0 deletions app/misc/templates/misc/code_of_conduct_page.html
Original file line number Diff line number Diff line change
@@ -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 %}
<div class="max-w-7xl mx-auto my-10">
<div class="px-6 md:px-10">
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
<div class="lg:col-span-2">
<h1 class="font-semibold text-h1">
{{page.title}}
</h1>
<div class="text-intro font-medium">
{{page.intro|safe}}
</div>

<h2 class="font-bold text-h2 mt-8">
{{page.short_version_title}}
</h2>
<div class="base-article-m">
{{page.short_version_body|safe}}
</div>

<h2 class="font-bold text-h2 mt-8">
{{page.full_version_title}}
</h2>
<div class="base-article-m">
{{page.full_version_body|safe}}
</div>

<h2 class="font-bold text-h2 mt-8">
{{page.complaint_handling_title}}
</h2>
<div class="base-article-m">
{{page.complaint_handling_body|safe}}
</div>
</div>

<div>
<h1 class="text-h2 font-bold">
{{page.our_policies_title}}
</h1>
<div class="grid gap-4 mt-4">
{% for policy in page.our_policies_links %}
<p>
{% include "ui/components/BaseLink.html" with linktext=policy.value.text linkurl=policy.value.link %}
</p>
{% endfor %}
</div>

<div class="bg-hot-off-white p-8 mt-16">
<h1 class="font-bold text-h3 mb-8">
{{page.question_block_title}}
</h1>
<a href="{{page.question_block_button_link}}">
{% include "components/branded_elements/button.html" with text=page.question_block_button_text %}
</a>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
73 changes: 73 additions & 0 deletions app/misc/templates/misc/privacy_policy_page.html
Original file line number Diff line number Diff line change
@@ -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 %}
<div class="max-w-7xl mx-auto my-10">
<div class="px-6 md:px-10">
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
<div class="lg:col-span-2 [&_h2]:mt-6 [&_h2]:mb-4 [&_h3]:mt-6 [&_h3]:mb-4">
<h1 class="font-semibold text-h1">
{{page.title}}
</h1>
<div class="text-intro font-medium">
{{page.intro|safe}}
</div>

<div class="base-article-m">
{{page.brief_body_text|safe}}

<h3>
{{page.table_of_contents_title}}
</h3>
<ol>
{% for section in page.body_sections %}
<a href="#section-{{forloop.counter}}">
<li>
{{section.value.title}}
</li>
</a>
{% endfor %}
</ol>

{% for section in page.body_sections %}
<h2 id="section-{{forloop.counter}}">
{{forloop.counter}}. {{section.value.title}}
</h2>
{{section.value.body|safe}}
{% endfor %}
</div>
</div>

<div>
<h1 class="text-h2 font-bold">
{{page.our_policies_title}}
</h1>
<div class="grid gap-4 mt-4">
{% for policy in page.our_policies_links %}
<p>
{% include "ui/components/BaseLink.html" with linktext=policy.value.text linkurl=policy.value.link %}
</p>
{% endfor %}
</div>

<div class="bg-hot-off-white p-8 mt-16">
<h1 class="font-bold text-h3 mb-8">
{{page.question_block_title}}
</h1>
<a href="{{page.question_block_button_link}}">
{% include "components/branded_elements/button.html" with text=page.question_block_button_text %}
</a>
</div>
</div>
</div>
</div>
</div>
{% endblock %}

0 comments on commit 5cf2942

Please sign in to comment.