Skip to content

Commit fb7344d

Browse files
bartazCopilot
andauthored
Add Gothenburg takeover and events navigation (#92)
* Add Gothenburg hero takeover to home page * Add events dropdown to navigation * Review fixes * Update JS var definitions to const. * Update templates/masterclasses.html Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent c2ca71c commit fb7344d

File tree

2 files changed

+114
-9
lines changed

2 files changed

+114
-9
lines changed

templates/base.html

Lines changed: 77 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,26 @@
4141
<li class="p-navigation__item">
4242
<a class="p-navigation__link" href="/videos">Videos</a>
4343
</li>
44+
<li class="p-navigation__item--dropdown-toggle" id="sprints-toggle">
45+
<a href="#sprints-toggle-menu" aria-controls="sprints-toggle-menu" class="p-navigation__link">Sprints</a>
46+
<ul class="p-navigation__dropdown" id="sprints-toggle-menu" aria-hidden="true">
47+
<li>
48+
<a href="/events/engineering-sprint-gothenburg-2025" class="p-navigation__dropdown-item">Engineering Sprint Gothenburg 2025</a>
49+
</li>
50+
<li>
51+
<a href="/events/roadmap-sprint-gothenburg-2025" class="p-navigation__dropdown-item">Roadmap Sprint Gothenburg 2025</a>
52+
</li>
53+
<li>
54+
<a href="/events/commercial-sprint-berlin-2025" class="p-navigation__dropdown-item">Commercial Sprint Berlin 2025</a>
55+
</li>
56+
<li>
57+
<a href="/events/engineering-sprint-frankfurt-2025" class="p-navigation__dropdown-item">Engineering Sprint Frankfurt 2025</a>
58+
</li>
59+
<li>
60+
<a href="/events/roadmap-sprint-frankfurt-2025" class="p-navigation__dropdown-item">Roadmap Sprint Frankfurt 2025</a>
61+
</li>
62+
</ul>
63+
</li>
4464
<li class="p-navigation__item">
4565
<a class="p-navigation__link" href="/register">Register Session</a>
4666
</li>
@@ -97,7 +117,7 @@
97117
function toggleMenu(e) {
98118
e.preventDefault();
99119

100-
var navigation = e.target.closest('.p-navigation');
120+
const navigation = e.target.closest('.p-navigation');
101121
if (navigation.classList.contains('has-menu-open')) {
102122
closeMenu();
103123
} else {
@@ -108,10 +128,10 @@
108128

109129
function openMenu(e) {
110130
e.preventDefault();
111-
var navigation = e.target.closest('.p-navigation');
112-
var nav = navigation.querySelector('.p-navigation__nav');
131+
const navigation = e.target.closest('.p-navigation');
132+
const nav = navigation.querySelector('.p-navigation__nav');
113133

114-
var buttons = document.querySelectorAll('.js-menu-button');
134+
const buttons = document.querySelectorAll('.js-menu-button');
115135

116136
buttons.forEach((searchButton) => {
117137
searchButton.setAttribute('aria-pressed', true);
@@ -122,11 +142,11 @@
122142
}
123143

124144
function closeMenu() {
125-
var navigation = document.querySelector('.p-navigation');
126-
var nav = navigation.querySelector('.p-navigation__nav');
145+
const navigation = document.querySelector('.p-navigation');
146+
const nav = navigation.querySelector('.p-navigation__nav');
127147

128-
var banner = document.querySelector('.p-navigation__banner');
129-
var buttons = document.querySelectorAll('.js-menu-button');
148+
const banner = document.querySelector('.p-navigation__banner');
149+
const buttons = document.querySelectorAll('.js-menu-button');
130150

131151
buttons.forEach((searchButton) => {
132152
searchButton.removeAttribute('aria-pressed');
@@ -143,6 +163,54 @@
143163
}
144164
}
145165

146-
var navigation = document.querySelector('#navigation');
166+
const navigation = document.querySelector('#navigation');
147167
initNavigation(navigation);
168+
169+
function toggleDropdown(toggle, open) {
170+
const parentElement = toggle.parentNode;
171+
const dropdown = document.getElementById(toggle.getAttribute('aria-controls'));
172+
dropdown.setAttribute('aria-hidden', !open);
173+
174+
if (open) {
175+
parentElement.classList.add('is-active');
176+
} else {
177+
parentElement.classList.remove('is-active');
178+
}
179+
}
180+
181+
function closeAllDropdowns(toggles) {
182+
toggles.forEach(function(toggle) {
183+
toggleDropdown(toggle, false);
184+
});
185+
}
186+
187+
function handleClickOutside(toggles, containerClass) {
188+
document.addEventListener('click', function(event) {
189+
const target = event.target;
190+
191+
if (target.closest) {
192+
if (!target.closest(containerClass)) {
193+
closeAllDropdowns(toggles);
194+
}
195+
}
196+
});
197+
}
198+
199+
function initNavDropdowns(containerClass) {
200+
const toggles = [].slice.call(document.querySelectorAll(containerClass + ' [aria-controls]'));
201+
202+
handleClickOutside(toggles, containerClass);
203+
204+
toggles.forEach(function(toggle) {
205+
toggle.addEventListener('click', function(e) {
206+
e.preventDefault();
207+
208+
const shouldOpen = !toggle.parentNode.classList.contains('is-active');
209+
closeAllDropdowns(toggles);
210+
toggleDropdown(toggle, shouldOpen);
211+
});
212+
});
213+
}
214+
215+
initNavDropdowns('.p-navigation__item--dropdown-toggle');
148216
</script>

templates/masterclasses.html

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,43 @@
44
{% from "_macros/vf_tiered-list.jinja" import vf_tiered_list %}
55

66
{% block content %}
7+
8+
{# hide main Gothenburg hero after the sprint has ended #}
9+
{% set gothenburg_end_unixtime = 1762560000 %} {# 2025-11-08T00:00:00Z #}
10+
{% if now < gothenburg_end_unixtime %}
11+
{% call(slot) vf_hero(
12+
title_text='Gothenburg Sprints',
13+
subtitle_text='October–November 2025',
14+
layout='50/50'
15+
) -%}
16+
{%- if slot == 'description' -%}
17+
<p>
18+
We are kicking off the 26.04 cycle in Gothenburg with Product Roadmap, and Engineering Sprints.
19+
Join us virtually on a live stream, or watch the recordings later in our Masterclass video library.
20+
</p>
21+
{%- endif -%}
22+
{%- if slot == 'cta' -%}
23+
<a href="https://stream.meet.google.com/stream/4f77e620-f41c-4ab9-beb2-29aa1c79dfd2" class="p-button--positive">Join the live stream</a>
24+
<a href="/events/roadmap-sprint-gothenburg-2025" class="p-button">Roadmap Sprint</a>
25+
<a href="/events/engineering-sprint-gothenburg-2025" class="p-button">Engineering Sprint</a>
26+
{%- endif -%}
27+
{%- if slot == 'image' -%}
28+
<div class="u-hide--medium u-hide--small">
29+
<div class="p-image-container--3-2">
30+
<img loading="auto" alt="Gothia Towers in Gothenburg"
31+
src="https://upload.wikimedia.org/wikipedia/commons/3/32/Gothia-towers-20110305.jpg"
32+
class="p-image-container__image">
33+
</div>
34+
<p class="u-text--muted u-text--small"><small>Copyright: Reimund Trost, licensed under <a href="https://commons.wikimedia.org/wiki/File:Gothia-towers-20110305.jpg">CC BY-SA 3.0</a></small></p>
35+
</div>
36+
{%- endif -%}
37+
{% endcall -%}
38+
39+
<div class="u-fixed-width">
40+
<hr class="p-rule" />
41+
</div>
42+
{% endif %}
43+
744
{% call(slot) vf_hero(
845
title_text='Masterclass',
946
subtitle_text='Your one-stop video library for Canonical talks',

0 commit comments

Comments
 (0)