diff --git a/apps/cms/migrations/0008_homepage_background_image.py b/apps/cms/migrations/0008_homepage_background_image.py new file mode 100644 index 00000000..5091b89b --- /dev/null +++ b/apps/cms/migrations/0008_homepage_background_image.py @@ -0,0 +1,27 @@ +# Generated by Django 3.2.25 on 2024-10-14 17:20 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ("wagtailimages", "0025_alter_image_file_alter_rendition_file"), + ("cms", "0007_homepage_featured_video"), + ] + + operations = [ + migrations.AddField( + model_name="homepage", + name="background_image", + field=models.ForeignKey( + blank=True, + help_text="Optional background image for the site header", + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="+", + to="wagtailimages.image", + ), + ), + ] diff --git a/apps/cms/models.py b/apps/cms/models.py index 9306d333..08f6bdea 100644 --- a/apps/cms/models.py +++ b/apps/cms/models.py @@ -257,6 +257,15 @@ class HomePage(Page): collections = Collection.objects.all()[:8] volumes = Manifest.objects.all()[:8] + background_image = models.ForeignKey( + 'wagtailimages.Image', + null=True, + blank=True, + on_delete=models.SET_NULL, + related_name='+', + help_text="Optional background image for the site header", + ) + featured_story_title = models.CharField( help_text="Title of the featured story", blank=True, max_length=255 ) @@ -286,6 +295,7 @@ class HomePage(Page): content_panels = Page.content_panels + [ FieldPanel('tagline', classname="full"), + FieldPanel('background_image', classname="full"), FieldPanel('content_display', classname="full"), AutocompletePanel('featured_collections', target_model="kollections.Collection"), FieldPanel('featured_collections_sort_order', classname="full"), diff --git a/apps/templates/_home/_nav.html b/apps/templates/_home/_nav.html index 2f7fe078..688b6ee6 100644 --- a/apps/templates/_home/_nav.html +++ b/apps/templates/_home/_nav.html @@ -6,7 +6,7 @@
{% main_menu add_sub_menus_inline=True %} diff --git a/apps/templates/cms/home_page.html b/apps/templates/cms/home_page.html index c15a5574..d0c8de8d 100644 --- a/apps/templates/cms/home_page.html +++ b/apps/templates/cms/home_page.html @@ -1,10 +1,5 @@ {% extends "base.html" %} -{% load static %} -{% load readux_templatetags %} -{% load wagtailcore_tags %} -{% load has_user_annotations %} -{% load user_annotation_count %} -{% load sass_tags %} +{% load has_user_annotations readux_templatetags sass_tags static user_annotation_count wagtailcore_tags wagtailimages_tags %} {% block extra_css %} {% endblock %} @@ -12,7 +7,10 @@ {% block content %} {% if request.path == '/' %} -
+
{% include '_home/_nav.html' %}