Skip to content

Commit

Permalink
Merge pull request #23 from chnm/refactor/api-data
Browse files Browse the repository at this point in the history
This PR adds the three column general page layout
  • Loading branch information
hepplerj authored Oct 9, 2024
2 parents 66bb094 + 172d078 commit 66bd4ad
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 0 deletions.
53 changes: 53 additions & 0 deletions exhibits/migrations/0030_generalpagethreecolumn.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Generated by Django 5.0.6 on 2024-10-09 17:06

import django.db.models.deletion
import wagtail.fields
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("exhibits", "0029_exhibitpage_image_first_column_zoomable_and_more"),
("wagtailcore", "0093_uploadedfile"),
]

operations = [
migrations.CreateModel(
name="GeneralPageThreeColumn",
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",
),
),
(
"column_one",
wagtail.fields.RichTextField(
blank=True, help_text="Column one content."
),
),
(
"column_two",
wagtail.fields.RichTextField(
blank=True, help_text="Column two content."
),
),
(
"column_three",
wagtail.fields.RichTextField(
blank=True, help_text="Column three content."
),
),
],
options={
"abstract": False,
},
bases=("wagtailcore.page",),
),
]
18 changes: 18 additions & 0 deletions exhibits/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,24 @@ class GeneralPage(Page):
]


class GeneralPageThreeColumn(Page):
column_one = RichTextField(blank=True, help_text="Column one content.")
column_two = RichTextField(blank=True, help_text="Column two content.")
column_three = RichTextField(blank=True, help_text="Column three content.")

search_fields = Page.search_fields + [
index.SearchField("column_one"),
index.SearchField("column_two"),
index.SearchField("column_three"),
]

content_panels = Page.content_panels + [
FieldPanel("column_one"),
FieldPanel("column_two"),
FieldPanel("column_three"),
]


class ExhibitHome(Page):
image = models.ForeignKey(
"wagtailimages.Image",
Expand Down
28 changes: 28 additions & 0 deletions exhibits/templates/exhibits/general_page_three_column.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{% extends 'base.html' %}
{% load static %}
{% load wagtailcore_tags wagtailimages_tags %}

{% block title %}Connecting Threads | {{ page.title }}{% endblock title %}

{% block content %}
<div class="container mx-auto px-4 py-8">
<div class="prose mb-4">
<h1>{{ page.title }}</h1>
</div>

<div class="grid grid-cols-1 lg:grid-cols-3 gap-2">
<!-- First Column -->
<div class="prose">
{{ page.column_one|richtext }}
</div>
<!-- Second Column -->
<div class="prose">
{{ page.column_two|richtext }}
</div>
<!-- Third Column -->
<div class="prose">
{{ page.column_three|richtext }}
</div>
</div>
</div>
{% endblock content %}
Binary file added static/img/va-red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
<img src="{% static "/img/rrchnm-logo.png" %}" alt="Roy Rosenzweig Center for History and New media" class="w-60 h-auto mx-4 mb-4">
<img src="{% static "/img/gmu-logo.png" %}" alt="George Mason University" class="w-60 h-auto mx-4 mb-4">
<img src="{% static "/img/edinburgh-logo.png" %}" alt="Edinburgh University" class="w-60 h-auto mx-4 mb-4">
<img src="{% static "/img/va-red.png" %}" alt="V&A Museum" class="w-20 h-auto mx-4 mb-4">
</div>

<div class="container mx-auto px-4">
Expand Down

0 comments on commit 66bd4ad

Please sign in to comment.