-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from hotosm/feat/ind-event-page
ind event page, navigation, staging
- Loading branch information
Showing
63 changed files
with
1,277 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class EventsConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'app.events' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Generated by Django 4.2.7 on 2024-06-05 19:43 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import wagtail.blocks | ||
import wagtail.fields | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
('wagtailcore', '0089_log_entry_data_json_null_to_object'), | ||
('wagtailimages', '0025_alter_image_file_alter_rendition_file'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='EventOwnerPage', | ||
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')), | ||
('event_location_title', models.CharField(default='Event Location')), | ||
('join_event_title', models.CharField(default='Join This Event')), | ||
('rsvp_button_text', models.CharField(default='RSVP')), | ||
('more_events_title', models.CharField(default='More Events')), | ||
('view_all_events_text', models.CharField(default='View all Events')), | ||
('view_all_events_url', models.URLField(blank=True)), | ||
], | ||
options={ | ||
'abstract': False, | ||
}, | ||
bases=('wagtailcore.page',), | ||
), | ||
migrations.CreateModel( | ||
name='IndividualEventPage', | ||
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')), | ||
('start_date_time', models.DateTimeField()), | ||
('end_date_time', models.DateTimeField()), | ||
('intro', wagtail.fields.RichTextField(blank=True)), | ||
('extended_description', wagtail.fields.StreamField([('text_block', wagtail.blocks.RichTextBlock(features=['h1', 'h2', 'h3', 'h4', 'bold', 'italic', 'link', 'ol', 'ul', 'hr', 'document-link', 'image', 'embed', 'code', 'blockquote']))], null=True, use_json_field=True)), | ||
('event_location', models.CharField(blank=True)), | ||
('rsvp_description', wagtail.fields.RichTextField(blank=True)), | ||
('rsvp_link', models.URLField(blank=True)), | ||
('image', models.ForeignKey(blank=True, help_text='Image to represent the event', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')), | ||
], | ||
options={ | ||
'abstract': False, | ||
}, | ||
bases=('wagtailcore.page',), | ||
), | ||
] |
25 changes: 25 additions & 0 deletions
25
app/events/migrations/0002_individualeventpage_more_events_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Generated by Django 4.2.7 on 2024-06-05 20:25 | ||
|
||
from django.db import migrations, models | ||
import wagtail.blocks | ||
import wagtail.fields | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('events', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='individualeventpage', | ||
name='more_events', | ||
field=wagtail.fields.StreamField([('event', wagtail.blocks.PageChooserBlock(page_type=['events.IndividualEventPage']))], blank=True, null=True, use_json_field=True), | ||
), | ||
migrations.AlterField( | ||
model_name='individualeventpage', | ||
name='rsvp_link', | ||
field=models.URLField(blank=True, help_text='If both RSVP Description and Link are empty, the RSVP section will be hidden.'), | ||
), | ||
] |
29 changes: 29 additions & 0 deletions
29
app/events/migrations/0003_eventownerpage_event_read_more_text_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Generated by Django 4.2.7 on 2024-06-05 22:09 | ||
|
||
from django.db import migrations, models | ||
import wagtail.fields | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('events', '0002_individualeventpage_more_events_and_more'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='eventownerpage', | ||
name='event_read_more_text', | ||
field=models.CharField(default='Read more'), | ||
), | ||
migrations.AlterField( | ||
model_name='individualeventpage', | ||
name='rsvp_description', | ||
field=wagtail.fields.RichTextField(blank=True, help_text='If this field is empty, the RSVP description will not appear.'), | ||
), | ||
migrations.AlterField( | ||
model_name='individualeventpage', | ||
name='rsvp_link', | ||
field=models.URLField(blank=True, help_text='If this field is empty, the RSVP button will not appear. If both RSVP Description and Link are empty, the RSVP section will be hidden.'), | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
from django.db import models | ||
|
||
from wagtail.models import Page | ||
from wagtail.fields import RichTextField, StreamField | ||
from wagtail.admin.panels import FieldPanel, MultiFieldPanel, PageChooserPanel | ||
from wagtail.blocks import CharBlock, StreamBlock, StructBlock, URLBlock, RichTextBlock, PageChooserBlock | ||
from modelcluster.fields import ParentalKey, ParentalManyToManyField | ||
|
||
|
||
class EventOwnerPage(Page): | ||
max_count = 1 | ||
|
||
event_location_title = models.CharField(default="Event Location") | ||
join_event_title = models.CharField(default="Join This Event") | ||
rsvp_button_text = models.CharField(default="RSVP") | ||
more_events_title = models.CharField(default="More Events") | ||
view_all_events_text = models.CharField(default="View all Events") | ||
view_all_events_url = models.URLField(blank=True) | ||
event_read_more_text = models.CharField(default="Read more") | ||
|
||
content_panels = Page.content_panels + [ | ||
FieldPanel('event_location_title'), | ||
FieldPanel('join_event_title'), | ||
FieldPanel('rsvp_button_text'), | ||
FieldPanel('more_events_title'), | ||
FieldPanel('view_all_events_text'), | ||
FieldPanel('view_all_events_url'), | ||
FieldPanel('event_read_more_text'), | ||
] | ||
|
||
|
||
class IndividualEventPage(Page): | ||
parent_page_type = [ | ||
'projects.ProjectOwnerPage' | ||
] | ||
|
||
start_date_time = models.DateTimeField() | ||
end_date_time = models.DateTimeField() | ||
|
||
image = models.ForeignKey( | ||
"wagtailimages.Image", | ||
null=True, | ||
blank=True, | ||
on_delete=models.SET_NULL, | ||
related_name="+", | ||
help_text="Image to represent the event" | ||
) | ||
intro = RichTextField(blank=True) | ||
extended_description = StreamField([ | ||
('text_block', RichTextBlock(features=[ | ||
'h1', 'h2', 'h3', 'h4', 'bold', 'italic', 'link', 'ol', 'ul', 'hr', 'document-link', 'image', 'embed', 'code', 'blockquote' | ||
])) | ||
], use_json_field=True, null=True) | ||
|
||
event_location = models.CharField(blank=True) | ||
rsvp_description = RichTextField(blank=True, help_text="If this field is empty, the RSVP description will not appear.") | ||
rsvp_link = models.URLField(blank=True, help_text="If this field is empty, the RSVP button will not appear. If both RSVP Description and Link are empty, the RSVP section will be hidden.") | ||
|
||
more_events = StreamField([ | ||
('event', PageChooserBlock(page_type="events.IndividualEventPage")) | ||
], use_json_field=True, null=True, blank=True) | ||
|
||
content_panels = Page.content_panels + [ | ||
MultiFieldPanel([ | ||
FieldPanel('start_date_time'), | ||
FieldPanel('end_date_time'), | ||
], heading="Date and Time"), | ||
MultiFieldPanel([ | ||
FieldPanel('image'), | ||
FieldPanel('intro'), | ||
FieldPanel('extended_description'), | ||
], heading="Body"), | ||
MultiFieldPanel([ | ||
FieldPanel('event_location'), | ||
FieldPanel('rsvp_description'), | ||
FieldPanel('rsvp_link'), | ||
FieldPanel('more_events'), | ||
], heading="Sidebar") | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
{% extends "base.html" %} | ||
{% load static %} | ||
{% load wagtailcore_tags %} | ||
{% load wagtailimages_tags %} | ||
{% load compress %} | ||
{% block body_class %}template-individualmappinghubpage{% endblock %} | ||
{% block extra_css %} | ||
{% compress css %} | ||
{% endcompress css %} | ||
{% endblock extra_css %} | ||
|
||
{% block content %} | ||
<div class="max-w-7xl mx-auto"> | ||
{% comment %} HEADER {% endcomment %} | ||
<div class="base-article px-10 py-5"> | ||
<h1>{{ page.title }}</h1> | ||
<p class="mt-2"> | ||
{{ page.start_date_time }} – {% if page.start_date_time.date == page.end_date_time.date %}{{ page.end_date_time.time }} {% else %} {{page.end_date_time}} {% endif %} | ||
</p> | ||
</div> | ||
|
||
<div class="grid grid-cols-1 lg:grid-cols-3 px-10 gap-8 pb-20"> | ||
{% comment %} BODY {% endcomment %} | ||
<div class="base-article-m py-5 col-span-2"> | ||
{% image page.image original class="pb-8" %} | ||
<div class="text-intro"> | ||
{{ page.intro|safe }} | ||
</div> | ||
{{ page.extended_description }} | ||
|
||
{% include "ui/components/sharers/ShareSection.html" with class="mt-10" %} | ||
</div> | ||
|
||
{% comment %} SIDEBAR {% endcomment %} | ||
<div class="base-article py-5 sidebar"> | ||
<h1> | ||
{{page.get_parent.specific.event_location_title}} | ||
</h1> | ||
<p class="my-2"> | ||
{{page.event_location}} | ||
</p> | ||
<hr class="my-6" /> | ||
|
||
{% if page.rsvp_description or page.rsvp_link %} | ||
<div class="bg-hot-off-white p-8 my-8"> | ||
<h1 class="mb-4"> | ||
{{page.get_parent.specific.join_event_title}} | ||
</h1> | ||
{{page.rsvp_description|safe}} | ||
|
||
{% if page.rsvp_link %} | ||
<a href="{{page.rsvp_link}}" class="[&_button]:mt-4"> | ||
{% include "components/branded_elements/button.html" with text=page.get_parent.specific.rsvp_button_text %} | ||
</a> | ||
{% endif %} | ||
</div> | ||
{% endif %} | ||
|
||
<div> | ||
<h1> | ||
{{page.get_parent.specific.more_events_title}} | ||
</h1> | ||
<div class="text-intro [&_span]:text-black my-4"> | ||
{% include "ui/components/BaseLink.html" with linktext=page.get_parent.specific.view_all_events_text linkurl=page.get_parent.specific.view_all_events_url %} | ||
</div> | ||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-1 gap-12 mt-10"> | ||
{% for event in page.more_events %} | ||
{% include "ui/components/events/EventPreviewBlockEvent.html" with event=event.value %} | ||
{% endfor %} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.shortcuts import render | ||
|
||
# Create your views here. |
20 changes: 20 additions & 0 deletions
20
app/projects/migrations/0021_individualprojectpage_related_events.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Generated by Django 4.2.7 on 2024-06-05 23:44 | ||
|
||
from django.db import migrations | ||
import wagtail.blocks | ||
import wagtail.fields | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('projects', '0020_remove_individualprojectpage_black_box_link_text_and_more'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='individualprojectpage', | ||
name='related_events', | ||
field=wagtail.fields.StreamField([('event_page', wagtail.blocks.PageChooserBlock(page_type=['events.IndividualEventPage']))], blank=True, null=True, use_json_field=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.