Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
184 changes: 91 additions & 93 deletions layouts/schedule/list.html
Original file line number Diff line number Diff line change
@@ -1,111 +1,109 @@
{{ define "main" }}


{{ .Content }}

{{ $lang := $.Page.Language.Lang }}
{{ $scheduleData := $.Site.Data.schedule }}
{{ $slotsData := $.Site.Data.slots }}
{{ $roomsData := $.Site.Data.rooms }}

<nav class="day-tabs">
{{ range $day := $.Site.Data.schedule }}
<a href="#day_{{$day.day}}">{{- partial "date-long.html" (dict "time" .day "lang" $lang) }}</a>
{{ end }}
</nav>

{{ $.Scratch.Set "maxEnd" 0 }}
{{ range $.Site.Data.slots }}
{{ if gt .row.end ($.Scratch.Get "maxEnd") }}
{{ $.Scratch.Set "maxEnd" .row.end }}
{{ end}}
{{ $maxEnd := 0 }}
{{ range $slotsData }}
{{ if gt .row.end $maxEnd }}
{{ $maxEnd = .row.end }}
{{ end }}
{{ end }}

{{ $maxEnd := $.Scratch.Get "maxEnd" }}

<section class="schedule{{ if $.Params.horizontal}} horizontal{{ end }}">

{{ range $day := $.Site.Data.schedule }}
{{ $time := split $day.start ":" }}
{{ $dayStartH := index $time 0 }}
{{ $dayStartM := index $time 1 }}
{{ $time := split $day.end ":" }}
{{ $dayEndH := index $time 0 }}
{{ $dayEndM := index $time 1 }}

<article id="day_{{$day.day}}" class="day"
style="--rooms: {{ len .rooms }}; --end: {{ $maxEnd }};">

<h2>{{- partial "date-long.html" (dict "time" .day "lang" $lang) }}</h2>

{{ with (index .rooms 0) }}
{{ range .slots }}
{{ $slot := index (where $.Site.Data.slots "key" .slot) 0 }}
{{ $time := split $slot.start ":" }}
{{ $hh := index $time 0 }}
{{ $mm := index $time 1 }}
<div class="slot" style="--duration: {{ $slot.duration }}; --row-start: {{ $slot.row.start }}; --row-end: {{ $slot.row.end }};">
<span class="hh">{{ $hh }}</span>
<span class="mm">{{ $mm }}</span>
</div>
{{ end }}
{{ end }}

{{ range $index, $room := .rooms }}
{{ range where (where $.Site.Data.rooms "key" $room.room) "skip" "!=" true }}
<!-- Room {{ $room.room }} -->
<div class="room {{ if (modBool $index 2)}}even{{end}}" style="--room: {{ $index }};">
<h3>
{{ .label }}
{{ if .description }}
<small>{{ .description }}</small>
{{ end }}
</h3>
</div>

{{ range $room.slots }}
{{ $sessionPage := index (where $.Site.AllPages "Params.key" .talk ) 0}}
{{ $slot := index (where $.Site.Data.slots "key" .slot) 0 }}
{{ $time := split $slot.start ":" }}
{{ $hh := index $time 0 }}
{{ $mm := index $time 1 }}
<div class="session format-{{$sessionPage.Params.format}} tag-{{ anchorize (delimit ($sessionPage.Params.tags | default (slice)) " " ) }}"
style="--room: {{ $index }}; --row-start: {{ $slot.row.start }}; --row-end: {{ $slot.row.end }};">

<span class="start">
<span class="hh">{{ $hh }}</span>
<span class="mm">{{ $mm }}</span>
</span>
{{ partial "schedule-session" $sessionPage }}

</div>
{{ end }}
<!-- End room {{ $room.room }} -->
{{ end }}
{{ end }}

</article>
{{ end }}

</section>

<!--<a href="#" class="goto-top" aria-label="Top">⬆︎</a>-->
<nav class="day-tabs" role="tablist" aria-label="Schedule Days">
{{ range $day := $scheduleData }}
<a href="#day_{{ $day.day }}" role="tab" aria-selected="false">
{{- partial "date-long.html" (dict "time" .day "lang" $lang) -}}
</a>
{{ end }}
</nav>


<section class="schedule{{ if $.Params.horizontal }} horizontal{{ end }}">
{{ range $day := $scheduleData }}
{{ $time := split $day.start ":" }}
{{ $dayStartH := index $time 0 }}
{{ $dayStartM := index $time 1 }}
{{ $time := split $day.end ":" }}
{{ $dayEndH := index $time 0 }}
{{ $dayEndM := index $time 1 }}

<article id="day_{{ $day.day }}" class="day" style="--rooms: {{ len .rooms }}; --end: {{ $maxEnd }};">
<h2>{{- partial "date-long.html" (dict "time" .day "lang" $lang) }}</h2>


{{ with (index .rooms 0) }}
{{ range .slots }}
{{ $slot := index (where $slotsData "key" .slot) 0 }}
{{ $time := split $slot.start ":" }}
{{ $hh := index $time 0 }}
{{ $mm := index $time 1 }}
<div class="slot" style="--duration: {{ $slot.duration }}; --row-start: {{ $slot.row.start }}; --row-end: {{ $slot.row.end }};">
<span class="hh">{{ $hh }}</span>
<span class="mm">{{ $mm }}</span>
</div>
{{ end }}
{{ end }}


{{ range $index, $room := .rooms }}
{{ range where (where $roomsData "key" $room.room) "skip" "!=" true }}
<div class="room {{ if (modBool $index 2) }}even{{ end }}" style="--room: {{ $index }};">
<h3>
{{ .label }}
{{ if .description }}
<small>{{ .description }}</small>
{{ end }}
</h3>
</div>

{{ range $room.slots }}
{{ $sessionPage := index (where $.Site.AllPages "Params.key" .talk) 0 }}
{{ $slot := index (where $slotsData "key" .slot) 0 }}
{{ $time := split $slot.start ":" }}
{{ $hh := index $time 0 }}
{{ $mm := index $time 1 }}
<div class="session format-{{ $sessionPage.Params.format }} tag-{{ anchorize (delimit ($sessionPage.Params.tags | default (slice)) " " ) }}"
style="--room: {{ $index }}; --row-start: {{ $slot.row.start }}; --row-end: {{ $slot.row.end }};"
aria-label="{{ $sessionPage.Title }} in {{ .label }}">

<span class="start">
<span class="hh">{{ $hh }}</span>
<span class="mm">{{ $mm }}</span>
</span>
{{ partial "schedule-session" $sessionPage }}
</div>
{{ end }}
{{ end }}
{{ end }}
</article>
{{ end }}
</section>

{{ end }}

{{ define "scripts" }}
<script>
function checkLinks() {
const currentDay = document.location.hash;
if (!currentDay) {
let firstDay = document.querySelector('nav.day-tabs a');
if (firstDay) {
firstDay.click();
}
function checkLinks() {
const currentDay = window.location.hash;
const tabs = document.querySelectorAll('nav.day-tabs a');

tabs.forEach(tab => {
tab.classList.toggle('active', tab.getAttribute('href') === currentDay);
});

if (!currentDay && tabs.length > 0) {
tabs[0].click();
}
document.querySelectorAll('nav.day-tabs a')
.forEach(function(lnk) {
lnk.classList.toggle('active', lnk.getAttribute('href') === currentDay);
});
}
window.addEventListener("load", checkLinks, false);
window.addEventListener("hashchange", checkLinks, false);
}

window.addEventListener('load', checkLinks);
window.addEventListener('hashchange', checkLinks);
</script>
{{ end }}