diff --git a/lelcsc/core/context_processors.py b/lelcsc/core/context_processors.py new file mode 100644 index 0000000..4aa79bf --- /dev/null +++ b/lelcsc/core/context_processors.py @@ -0,0 +1,12 @@ +from .signals import populate_nav + + +def nav(request): + nav_items = [ + item + for _, items in populate_nav.send(sender=request) + if isinstance(items, list) + for item in items + ] + + return {"nav_items": nav_items} diff --git a/lelcsc/core/signals.py b/lelcsc/core/signals.py new file mode 100644 index 0000000..2764c3e --- /dev/null +++ b/lelcsc/core/signals.py @@ -0,0 +1,3 @@ +from django.dispatch import Signal + +populate_nav = Signal() diff --git a/lelcsc/core/templates/base.html b/lelcsc/core/templates/base.html index 4103fa8..b21abf7 100644 --- a/lelcsc/core/templates/base.html +++ b/lelcsc/core/templates/base.html @@ -13,11 +13,20 @@
{% block body %} + {% block navbar %} + {% include "partials/navbar.html" %} + {% endblock %} {% block messages %} {% bootstrap_messages %} {% endblock %} {% block content %} {% endblock %} {% endblock %} + +