Skip to content

Commit

Permalink
Merge pull request #16 from chnm/refactor/exhibits
Browse files Browse the repository at this point in the history
Three-column layouts and adjusted caption and view full image interactions
  • Loading branch information
hepplerj authored Oct 2, 2024
2 parents 2380ad7 + 6f62615 commit 85b2685
Show file tree
Hide file tree
Showing 59 changed files with 43,024 additions and 148 deletions.
20 changes: 20 additions & 0 deletions exhibits/migrations/0025_exhibitpage_image_zoomable.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 5.0.6 on 2024-10-01 15:51

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("exhibits", "0024_exhibitpage_display_title_alter_exhibitpage_layout"),
]

operations = [
migrations.AddField(
model_name="exhibitpage",
name="image_zoomable",
field=models.BooleanField(
default=False,
help_text="Check this box if you want the image to be zoomable.",
),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Generated by Django 5.0.6 on 2024-10-02 13:17

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


class Migration(migrations.Migration):
dependencies = [
("exhibits", "0025_exhibitpage_image_zoomable"),
("wagtailimages", "0026_delete_uploadedimage"),
]

operations = [
migrations.AddField(
model_name="exhibitpage",
name="image_first_column",
field=models.ForeignKey(
blank=True,
help_text="First image for three-column layouts.",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to="wagtailimages.image",
),
),
migrations.AddField(
model_name="exhibitpage",
name="image_second_column",
field=models.ForeignKey(
blank=True,
help_text="Second image for three-column layouts.",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to="wagtailimages.image",
),
),
migrations.AlterField(
model_name="exhibitpage",
name="image",
field=models.ForeignKey(
blank=True,
help_text="Image for the exhibit page.",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to="wagtailimages.image",
),
),
migrations.AlterField(
model_name="exhibitpage",
name="image_caption",
field=models.CharField(
blank=True,
help_text="Use this field for single column or two-column layouts.",
max_length=500,
verbose_name="Image caption",
),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Generated by Django 5.0.6 on 2024-10-02 13:24

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("exhibits", "0026_exhibitpage_image_first_column_and_more"),
]

operations = [
migrations.AddField(
model_name="exhibitpage",
name="image_first_column_caption",
field=models.CharField(
blank=True,
help_text="Caption for the first image.",
max_length=500,
verbose_name="Image caption",
),
),
migrations.AddField(
model_name="exhibitpage",
name="image_second_column_caption",
field=models.CharField(
blank=True,
help_text="Caption for the second image.",
max_length=500,
verbose_name="Image caption",
),
),
migrations.AlterField(
model_name="exhibitpage",
name="layout",
field=models.CharField(
choices=[
("left_image_one_third", "Left Image, One Third"),
("right_image_one_third", "Right Image, One Third"),
("left_image_two_thirds", "Left Image, Two Thirds"),
("right_image_two_thirds", "Right Image, Two Thirds"),
("three_column_images_left", "Three Column, Images on Left"),
("three_column_images_right", "Three Column, Images on Right"),
("half_and_half", "Half and Half"),
("full_screen", "Full Screen"),
("wide_image", "Wide Image"),
],
default="left_image_one_third",
help_text="Select the layout for this exhibit page.",
max_length=25,
),
),
]
25 changes: 25 additions & 0 deletions exhibits/migrations/0028_exhibitpage_link_to_subsection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 5.0.6 on 2024-10-02 15:49

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


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

operations = [
migrations.AddField(
model_name="exhibitpage",
name="link_to_subsection",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to="wagtailcore.page",
),
),
]
69 changes: 64 additions & 5 deletions exhibits/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,15 @@ class ExhibitPage(Page):
("right_image_one_third", "Right Image, One Third"),
("left_image_two_thirds", "Left Image, Two Thirds"),
("right_image_two_thirds", "Right Image, Two Thirds"),
("three_column_images_left", "Three Column, Images on Left"),
("three_column_images_right", "Three Column, Images on Right"),
("half_and_half", "Half and Half"),
("full_screen", "Full Screen"),
("wide_image", "Wide Image"),
]

layout = models.CharField(
max_length=22,
max_length=25,
choices=LAYOUT_CHOICES,
default="left_image_one_third",
help_text="Select the layout for this exhibit page.",
Expand All @@ -154,15 +156,47 @@ class ExhibitPage(Page):
image = models.ForeignKey(
"wagtailimages.Image",
null=True,
blank=False,
blank=True,
on_delete=models.SET_NULL,
related_name="+",
help_text="Image for the exhibit page.",
)
image_caption = models.CharField(
max_length=500,
blank=True,
help_text="Caption for the exhibit page image.",
help_text="Use this field for single column or two-column layouts.",
verbose_name="Image caption",
)
image_zoomable = models.BooleanField(
default=False,
help_text="Check this box if you want the image to be zoomable.",
)
image_first_column = models.ForeignKey(
"wagtailimages.Image",
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name="+",
help_text="First image for three-column layouts.",
)
image_first_column_caption = models.CharField(
max_length=500,
blank=True,
help_text="Caption for the first image.",
verbose_name="Image caption",
)
image_second_column = models.ForeignKey(
"wagtailimages.Image",
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name="+",
help_text="Second image for three-column layouts.",
)
image_second_column_caption = models.CharField(
max_length=500,
blank=True,
help_text="Caption for the second image.",
verbose_name="Image caption",
)
body = RichTextField(blank=True)
Expand All @@ -180,15 +214,40 @@ class ExhibitPage(Page):
on_delete=models.SET_NULL,
related_name="+",
)
link_to_subsection = models.ForeignKey(
"wagtailcore.Page",
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name="+",
)

content_panels = Page.content_panels + [
FieldPanel("layout"),
FieldPanel("display_title"),
FieldPanel("image"),
FieldPanel("image_caption"),
MultiFieldPanel(
[
FieldPanel("image"),
FieldPanel("image_caption"),
FieldPanel("image_zoomable"),
],
heading="Single Image",
help_text="These fields are for the single column or two-column page layouts.",
),
MultiFieldPanel(
[
FieldPanel("image_first_column"),
FieldPanel("image_first_column_caption"),
FieldPanel("image_second_column"),
FieldPanel("image_second_column_caption"),
],
heading="Three Column Image Layout",
help_text="These fields are for the three-column page layouts.",
),
FieldPanel("body"),
FieldPanel("link_to_next_page"),
FieldPanel("link_to_previous_page"),
FieldPanel("link_to_subsection"),
InlinePanel(
"image_comparisons",
label="Image Comparisons",
Expand Down
Loading

0 comments on commit 85b2685

Please sign in to comment.