From b1b6aeb818456048d16613ff52013d2f71ce3c0a Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Tue, 14 Jun 2022 20:57:43 +0100 Subject: [PATCH] Add basic content page --- static/src/scss/_content.scss | 3 ++ static/src/scss/_hero.scss | 43 +++++++++++++++++++ static/src/scss/base.scss | 2 + website/common/migrations/0001_initial.py | 37 ++++++++++++++++ website/common/migrations/__init__.py | 0 website/common/models.py | 8 ++++ .../common/templates/common/content_page.html | 42 ++++++++++++++++++ website/settings.py | 1 + 8 files changed, 136 insertions(+) create mode 100644 static/src/scss/_content.scss create mode 100644 static/src/scss/_hero.scss create mode 100644 website/common/migrations/0001_initial.py create mode 100644 website/common/migrations/__init__.py create mode 100644 website/common/templates/common/content_page.html diff --git a/static/src/scss/_content.scss b/static/src/scss/_content.scss new file mode 100644 index 0000000..cc3ac59 --- /dev/null +++ b/static/src/scss/_content.scss @@ -0,0 +1,3 @@ +.content { + font-size: 1.25rem; +} diff --git a/static/src/scss/_hero.scss b/static/src/scss/_hero.scss new file mode 100644 index 0000000..d6357a7 --- /dev/null +++ b/static/src/scss/_hero.scss @@ -0,0 +1,43 @@ +section.hero { + position: sticky; + top: 0; + z-index: 10; + margin-top: 2.5rem; + padding-top: 0.5rem; + margin-bottom: 1.5rem; + background-color: $white; + + .hero-body { + padding: 0; + } + + .dropdown-wrapper { + display: flex; + align-items: flex-end; + justify-content: flex-end; + } + + .dropdown { + li { + list-style: none !important; + } + + .dropdown-content { + width: 17rem; + overflow-y: scroll; + max-height: 50vh; + } + + ul { + margin: 0.5rem; + } + + .menu-list li ul { + padding-left: initial; + } + } + + .subtitle { + margin-bottom: 0.5rem; + } +} diff --git a/static/src/scss/base.scss b/static/src/scss/base.scss index a06cc65..b35f64d 100644 --- a/static/src/scss/base.scss +++ b/static/src/scss/base.scss @@ -5,6 +5,8 @@ @import "navbar"; @import "homepage"; @import "footer"; +@import "hero"; +@import "content"; html, body { diff --git a/website/common/migrations/0001_initial.py b/website/common/migrations/0001_initial.py new file mode 100644 index 0000000..b041c79 --- /dev/null +++ b/website/common/migrations/0001_initial.py @@ -0,0 +1,37 @@ +# Generated by Django 4.0.5 on 2022-06-14 19:20 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ("wagtailcore", "0069_log_entry_jsonfield"), + ] + + operations = [ + migrations.CreateModel( + name="ContentPage", + 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", + ), + ), + ("subtitle", models.CharField(blank=True, max_length=255)), + ], + options={ + "abstract": False, + }, + bases=("wagtailcore.page",), + ), + ] diff --git a/website/common/migrations/__init__.py b/website/common/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/website/common/models.py b/website/common/models.py index 52dcc3f..d21f042 100644 --- a/website/common/models.py +++ b/website/common/models.py @@ -1,3 +1,5 @@ +from django.db import models +from wagtail.admin.panels import FieldPanel from wagtail.models import Page @@ -9,3 +11,9 @@ class BasePage(Page): @property def body_class(cls) -> str: return "page-" + cls._meta.db_table.replace("_", "-") + + +class ContentPage(BasePage): + subtitle = models.CharField(max_length=255, blank=True) + + content_panels = BasePage.content_panels + [FieldPanel("subtitle")] diff --git a/website/common/templates/common/content_page.html b/website/common/templates/common/content_page.html new file mode 100644 index 0000000..059c7ac --- /dev/null +++ b/website/common/templates/common/content_page.html @@ -0,0 +1,42 @@ +{% extends "wagtail_base.html" %} + +{% block content %} +
+
+
+
+

{{ page.title }}

+ {% if page.subtitle %} +

{{ page.subtitle }}

+ {% endif %} +
+ +
+ +
+
+ +
+ {% lorem 10 p %} +
+{% endblock content %} diff --git a/website/settings.py b/website/settings.py index e4da9cc..3a6fe6f 100644 --- a/website/settings.py +++ b/website/settings.py @@ -19,6 +19,7 @@ EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" # Application definition INSTALLED_APPS = [ + "website.common", "website.home", "website.search", "wagtail.contrib.forms",