www.iger.events/layouts/shortcodes/schedule.html

103 lines
3.3 KiB
HTML

{{ $data := getJSON (.Get "url") }}
{{ with $data.schedule }}
{{ $timeslotDuration := 0 }}
{{ range split .conference.timeslot_duration ":" }}
{{ $timeslotDuration = add (mul $timeslotDuration 60) (int .) }}
{{ end }}
{{ $rooms := dict }}
{{ range $day := .conference.days }}
{{ range $room := $data.schedule.conference.rooms }}
{{ with index $day.rooms $room.name }}
{{ if index $rooms $room.name }}
{{ $rooms = merge $rooms (dict $room.name ((index $rooms $room.name) | append .)) }}
{{ else }}
{{ $rooms = merge $rooms (dict $room.name .) }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ $events := slice }}
{{ range $rooms }}
{{ with . }}
{{ if $events }}
{{ $events = $events | append . }}
{{ else }}
{{ $events = . }}
{{ end }}
{{ end }}
{{ end }}
{{ $events = sort $events "date" }}
{{ $startDate := time (index $events 0).date }}
{{ $endDate := 0 }}
{{ with index $events (sub (len $events) 1) }}
{{ $lastDuration := 0 }}
{{ range split .duration ":" }}
{{ $lastDuration = add (mul $lastDuration 60) (int .) }}
{{ end }}
{{ $endDate = time (add (time .date).Unix (mul $lastDuration 60)) }}
{{ end }}
<p class="schedule-info">
Version: <span class="schedule-version">{{ .version }}</span>
<br>Zeitangaben in <span class="schedule-timezone">{{ $startDate.Format "MST" }}</span>
</p>
<div class="schedule-days">
{{ range .conference.days }}
<a href="#{{ .date }}">{{ .date }}</a>&middot;
{{ end }}
<a href="#">zurück nach oben</a>
</div>
<div class="schedule">
<div class="schedule-grid schedule-timeline" style="--span: {{ div 30 $timeslotDuration }}">
<h3 class="schedule-title"></h3>
{{ $lastDate := 0 }}
{{ range seq 1 (div 30 $timeslotDuration) (div ($endDate.Sub $startDate).Minutes $timeslotDuration) }}
{{ $date := time (add $startDate.Unix (mul (sub . 1) (mul $timeslotDuration 60))) }}
<div class="schedule-time" style="--start: {{ . }}">
{{ if or (not $lastDate) (ne ($date.Format "2006-01-02") ($lastDate.Format "2006-01-02")) }}
<div class="schedule-date" id="{{ $date.Format "2006-01-02" }}">{{ $date.Format "2006-01-02" }}</div>
{{ end }}
{{ $date.Format "15:04" }}
</div>
{{ $lastDate = $date }}
{{ end }}
</div>
{{ range sort $data.schedule.conference.rooms "name" }}
{{ $name := .name }}
{{ $room := index $rooms $name }}
{{ with $room }}
<div class="schedule-grid schedule-room">
<h3 class="schedule-title">{{ $name }}</h3>
{{ range . }}
{{ $start := add (div ((time .date).Sub $startDate).Minutes $timeslotDuration) 1 }}
{{ $duration := 0 }}
{{ range split .duration ":" }}
{{ $duration = add (mul $duration 60) (int .) }}
{{ end }}
{{ $end := add $start (div $duration $timeslotDuration) }}
<a class="schedule-event" href="{{ .url }}" style="--start: {{ $start }};--end: {{ $end }}" target="_blank">
<div class="schedule-event-time">
<span>{{ (time .date).Format "15:04" }}</span>
<span>&ndash;</span>
<span>{{ (time (int (add $startDate.Unix (mul (sub $end 1) (mul $timeslotDuration 60))))).Format "15:04" }}</span>
</div>
<div class="schedule-event-detail">
<h4 class="schedule-title" title="{{ .title }}">{{ .title }}</h4>
{{ $speaker := delimit (apply .persons "index" "." "public_name") ", " }}
<p class="schedule-speaker" title="{{ $speaker }}">{{ $speaker }}</p>
</div>
</a>
{{ end }}
</div>
{{ end }}
{{ end }}
</div>
{{ end }}