Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ind event page, navigation, staging #28

Merged
merged 4 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ DB_PASSWORD=${DB_PASSWORD:-postgres}
DB_HOST=${DB_HOST:-db}
DB_PORT=${DB_PORT:-5432}

# aws settings
AWS_STORAGE_BUCKET_NAME=${AWS_STORAGE_BUCKET_NAME}
AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}

# Integration settings
BROWSER_STACK_USER=${BROWSER_STACK_USER:-}
BROWSER_ACCESS_KEY=${BROWSERSTACK_API_KEY:-}
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -157,5 +157,7 @@ FROM runtime as prod
HEALTHCHECK --start-period=10s --interval=5s --retries=20 --timeout=5s \
CMD curl --fail http://localhost:8000 || exit 1
# Pre-compile packages to .pyc (init speed gains)
USER root
RUN python -c "import compileall; compileall.compile_path(maxlevels=10, quiet=1)"
CMD ["gunicorn", "hot_osm.wsgi:application"]
USER wagtail
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "hot_osm.wsgi:application"]
Empty file added app/events/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions app/events/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
6 changes: 6 additions & 0 deletions app/events/apps.py
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'
53 changes: 53 additions & 0 deletions app/events/migrations/0001_initial.py
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',),
),
]
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.'),
),
]
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.
79 changes: 79 additions & 0 deletions app/events/models.py
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")
]
75 changes: 75 additions & 0 deletions app/events/templates/events/individual_event_page.html
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 }} &#x2013; {% 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 %}
3 changes: 3 additions & 0 deletions app/events/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
3 changes: 3 additions & 0 deletions app/events/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.shortcuts import render

# Create your views here.
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),
),
]
5 changes: 5 additions & 0 deletions app/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ class IndividualProjectPage(Page):
('news_page', PageChooserBlock(page_type="news.IndividualNewsPage"))
], use_json_field=True, null=True, blank=True)

related_events = StreamField([
('event_page', PageChooserBlock(page_type="events.IndividualEventPage"))
], use_json_field=True, null=True, blank=True)

project_contributors = StreamField([('contributor', PageChooserBlock(page_type="members.IndividualMemberPage"))], use_json_field=True, null=True, blank=True)

content_panels = Page.content_panels + [
Expand Down Expand Up @@ -150,6 +154,7 @@ class IndividualProjectPage(Page):
FieldPanel('contact'),
MultiFieldPanel([
FieldPanel('related_news'),
FieldPanel('related_events'),
], heading="Related Pages"),
], heading="Sidebar"),
MultiFieldPanel([
Expand Down
21 changes: 14 additions & 7 deletions app/projects/templates/projects/individual_project_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,21 @@ <h1 class="text-h2 font-bold mb-4">
{% endif %}

{% comment %} RELATED EVENTS {% endcomment %}
<div class="my-12">
<h1 class="text-h2 font-bold mb-4">
{{ page.get_parent.specific.related_events_title }}
</h1>
<div class="[&_span]:text-black text-intro">
{% include "ui/components/BaseLink.html" with linkurl=page.get_parent.specific.view_all_events_url linktext=page.get_parent.specific.view_all_events_text %}
{% if page.related_events %}
<div class="my-12">
<h1 class="text-h2 font-bold mb-4">
{{ page.get_parent.specific.related_events_title }}
</h1>
<div class="[&_span]:text-black text-intro">
{% include "ui/components/BaseLink.html" with linkurl=page.get_parent.specific.view_all_events_url linktext=page.get_parent.specific.view_all_events_text %}
</div>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-1 gap-12 mt-10">
{% for event in page.related_events %}
{% include "ui/components/events/EventPreviewBlockEvent.html" with event=event.value %}
{% endfor %}
</div>
</div>
</div>
{% endif %}
</div>
</div>

Expand Down
Loading
Loading