From a9b2a856d591fe81fa9bd2b265a30a60de4d7d10 Mon Sep 17 00:00:00 2001 From: Christian Henriksen Date: Wed, 21 Jan 2026 00:22:07 +0100 Subject: [PATCH 1/4] Rename existing css class from 'bornhack-program-menu' to 'bornhack-sub-menu' --- src/program/templates/includes/program_menu.html | 12 ++++++------ src/static_src/css/bornhack.css | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/program/templates/includes/program_menu.html b/src/program/templates/includes/program_menu.html index 9ba2833e8..2e38a232d 100644 --- a/src/program/templates/includes/program_menu.html +++ b/src/program/templates/includes/program_menu.html @@ -1,13 +1,13 @@ {% if camp.show_schedule %} - Schedule + Schedule {% endif %} -Events -Speakers -Call for Participation +Events +Speakers +Call for Participation {% if request.user.is_authenticated %} {% if camp.call_for_participation_open %} - Submit Proposal + Submit Proposal {% else %} - View Proposals + View Proposals {% endif %} {% endif %} diff --git a/src/static_src/css/bornhack.css b/src/static_src/css/bornhack.css index 6bcb53c5f..4a045289d 100644 --- a/src/static_src/css/bornhack.css +++ b/src/static_src/css/bornhack.css @@ -36,11 +36,11 @@ strong { font-weight: bold; } } /* Navbar buttom customization */ -.bornhack-program-menu, .btn-menu { +.bornhack-sub-menu, .btn-menu { --bs-btn-border-width: unset !important; } -.btn-primary.bornhack-program-menu { +.btn-primary.bornhack-sub-menu { background-color: unset; color: var(--bs-info); } From 911c6f579f69fa71ae49875146b5fc24cf4d034b Mon Sep 17 00:00:00 2001 From: Christian Henriksen Date: Wed, 21 Jan 2026 00:29:28 +0100 Subject: [PATCH 2/4] Refactor submenu items into 'program_base.html' for locality of behaviour concept. --- src/program/templates/includes/program_menu.html | 13 ------------- src/program/templates/program_base.html | 14 +++++++++++++- 2 files changed, 13 insertions(+), 14 deletions(-) delete mode 100644 src/program/templates/includes/program_menu.html diff --git a/src/program/templates/includes/program_menu.html b/src/program/templates/includes/program_menu.html deleted file mode 100644 index 2e38a232d..000000000 --- a/src/program/templates/includes/program_menu.html +++ /dev/null @@ -1,13 +0,0 @@ -{% if camp.show_schedule %} - Schedule -{% endif %} -Events -Speakers -Call for Participation -{% if request.user.is_authenticated %} - {% if camp.call_for_participation_open %} - Submit Proposal - {% else %} - View Proposals - {% endif %} -{% endif %} diff --git a/src/program/templates/program_base.html b/src/program/templates/program_base.html index 5413cf9a6..7a34a53bf 100644 --- a/src/program/templates/program_base.html +++ b/src/program/templates/program_base.html @@ -10,7 +10,19 @@
- {% include 'includes/program_menu.html' %} + {% if camp.show_schedule %} + Schedule + {% endif %} + Events + Speakers + Call for Participation + {% if request.user.is_authenticated %} + {% if camp.call_for_participation_open %} + Submit Proposal + {% else %} + View Proposals + {% endif %} + {% endif %}

From 40a865878bceee731d83b48d5731e130908f4bf5 Mon Sep 17 00:00:00 2001 From: Christian Henriksen Date: Wed, 21 Jan 2026 01:36:25 +0100 Subject: [PATCH 3/4] Add new 'sponsors_base.html' template and extend 'sponsors.html' --- src/sponsors/templates/sponsors.html | 18 +++--------------- src/sponsors/templates/sponsors_base.html | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 src/sponsors/templates/sponsors_base.html diff --git a/src/sponsors/templates/sponsors.html b/src/sponsors/templates/sponsors.html index 9526505f3..febb582da 100644 --- a/src/sponsors/templates/sponsors.html +++ b/src/sponsors/templates/sponsors.html @@ -1,4 +1,4 @@ -{% extends 'base.html' %} +{% extends 'sponsors_base.html' %} {% load static %} {% load commonmark %} @@ -7,7 +7,7 @@ {% endblock %} -{% block content %} +{% block sponsors_content %} {% if sponsors %} @@ -53,16 +53,4 @@

{{ sponsor.tier.name}}

{% endif %} {% endfor %} - {% if not camp.call_for_sponsors_open %} -
- Note! This Call for Sponsors is not open. -
- {% endif %} - - {% if not camp.call_for_sponsors %} -

This CFS has not been written yet.

- {% else %} - {{ camp.call_for_sponsors|trustedcommonmark }} - {% endif %} - -{% endblock %} +{% endblock sponsors_content %} diff --git a/src/sponsors/templates/sponsors_base.html b/src/sponsors/templates/sponsors_base.html new file mode 100644 index 000000000..b87e04ae2 --- /dev/null +++ b/src/sponsors/templates/sponsors_base.html @@ -0,0 +1,23 @@ +{% extends 'base.html' %} + +{% block title %} + Sponsors | {{ block.super }} +{% endblock %} + +{% block content %} + + {% with url_name=request.resolver_match.url_name proposal_urls="proposal_list,speaker_proposal_create,speaker_proposal_detail,speaker_proposal_update,speaker_proposal_submit,speaker_proposal_picture,event_proposal_create,event_proposal_detail,event_proposal_update,event_proposal_submit" %} + + + + {% block sponsors_content %} + {% endblock sponsors_content %} + + {% endwith %} + +{% endblock %} From c20f9e8aa203b9c91b5e33b13fffdca72563caea Mon Sep 17 00:00:00 2001 From: Christian Henriksen Date: Wed, 21 Jan 2026 01:37:40 +0100 Subject: [PATCH 4/4] Add Call for sponsors view and template, with redirect from existing sponsors page if no sponsors has been added --- src/bornhack/urls.py | 2 ++ src/sponsors/templates/call_for_sponsors.html | 22 +++++++++++++++++++ src/sponsors/views.py | 14 ++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 src/sponsors/templates/call_for_sponsors.html diff --git a/src/bornhack/urls.py b/src/bornhack/urls.py index a0cdc61f3..7e14bf4e9 100644 --- a/src/bornhack/urls.py +++ b/src/bornhack/urls.py @@ -25,6 +25,7 @@ from people.views import PeopleView from sponsors.views import AllSponsorsView from sponsors.views import SponsorsView +from sponsors.views import CallForSponsorsView from utils.views import csrfview # require 2fa token entry (if enabled on admin account) when logging into /admin by using allauth login form @@ -160,6 +161,7 @@ path("info/", CampInfoView.as_view(), name="info"), path("program/", include("program.urls", namespace="program")), path("sponsors/", SponsorsView.as_view(), name="sponsors"), + path("sponsors/call-for-sponsors", CallForSponsorsView.as_view(), name="call_for_sponsors"), path( "map/", include( diff --git a/src/sponsors/templates/call_for_sponsors.html b/src/sponsors/templates/call_for_sponsors.html new file mode 100644 index 000000000..da9678517 --- /dev/null +++ b/src/sponsors/templates/call_for_sponsors.html @@ -0,0 +1,22 @@ +{% extends 'sponsors_base.html' %} +{% load commonmark %} + +{% block title %} + Call for Sponsors | {{ block.super }} +{% endblock %} + +{% block sponsors_content %} + + {% if not camp.call_for_sponsors_open %} +
+ Note! This Call for Sponsors is not open. +
+ {% endif %} + + {% if not camp.call_for_sponsors %} +

This CFS has not been written yet.

+ {% else %} + {{ camp.call_for_sponsors|trustedcommonmark }} + {% endif %} + +{% endblock sponsors_content %} diff --git a/src/sponsors/views.py b/src/sponsors/views.py index c7c6c3bc2..2f9ebb53c 100644 --- a/src/sponsors/views.py +++ b/src/sponsors/views.py @@ -5,14 +5,21 @@ from django.db.models import Sum from django.db.models.functions import ExtractYear from django.db.models.functions import Lower +from django.shortcuts import redirect +from django.urls import reverse from django.utils import timezone from django.views.generic import ListView +from django.views.generic import TemplateView from camps.mixins import CampViewMixin from .models import Sponsor +class CallForSponsorsView(CampViewMixin, TemplateView): + template_name = "call_for_sponsors.html" + + class SponsorsView(CampViewMixin, ListView): model = Sponsor template_name = "sponsors.html" @@ -22,6 +29,13 @@ def get_queryset(self, **kwargs): queryset = super().get_queryset() return queryset.filter(tier__camp=self.camp).order_by("tier__weight", "name") + def get(self, request, *args, **kwargs): + self.object_list = self.get_queryset() + if self.object_list.count() < 1: + url = reverse("call_for_sponsors", kwargs={"camp_slug": self.camp.slug}) + return redirect(url) + return super().get(request, *args, **kwargs) + class AllSponsorsView(ListView): model = Sponsor