Skip to content

Commit

Permalink
Merge pull request #1077 from ecds/feature/footer-menu
Browse files Browse the repository at this point in the history
Footer menu migration and template
  • Loading branch information
blms authored Sep 23, 2024
2 parents f85f0a3 + 26ab61d commit fe4430e
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 6 deletions.
33 changes: 33 additions & 0 deletions apps/cms/migrations/0006_create_footermenu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated by Django 3.2.25 on 2024-09-19 20:35

from django.db import migrations


def create_footer_menu(apps, schema_editor):
"""
Data migration to create a flat menu for the footer items.
"""
Site = apps.get_model("wagtailcore", "Site")
FlatMenu = apps.get_model("wagtailmenus", "FlatMenu")
try:
site = Site.objects.get(is_default_site=True)
except Site.DoesNotExist:
site = Site.objects.first()
try:
FlatMenu.objects.get(handle="footer-menu")
except FlatMenu.DoesNotExist:
FlatMenu.objects.create(
title="Footer menu",
handle="footer-menu",
max_levels=1,
site=site,
)


class Migration(migrations.Migration):

dependencies = [
("cms", "0005_homepage_featured_story"),
]

operations = [migrations.RunPython(create_footer_menu, migrations.RunPython.noop)]
9 changes: 3 additions & 6 deletions apps/templates/_home/_footer.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
{% load static %}
{% load static menu_tags %}

<div class="footer">
<div class="uk-container">
<div class="footer-content uk-flex uk-flex-middle uk-flex-between">
<div class="footer-links uk-flex uk-flex-column uk-flex-center">
<a href="#">What Is Readux?</a>
<a href="#">What Is Sounding Spirit?</a>
<a href="#">Terms of Service</a>
</div>
{% flat_menu 'footer-menu' template="menus/footer_menu.html" %}
<div class="footer-logo">
<a href="https://ecds.emory.edu">
<img src="{% static 'images/ecds-inverse.svg' %}" alt="Logo" style="height: 10vh;">
Expand Down
7 changes: 7 additions & 0 deletions apps/templates/menus/footer_menu.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% load menu_tags %}

<div class="footer-links uk-flex uk-flex-column uk-flex-center">
{% for item in menu_items %}
<a href="{{ item.href }}">{{ item.text }}</a>
{% endfor %}
</div>

0 comments on commit fe4430e

Please sign in to comment.