WIP create calendar
This commit is contained in:
18
themes/tsc_vfl/layouts/partials/tsc/calendar/list.html
Normal file
18
themes/tsc_vfl/layouts/partials/tsc/calendar/list.html
Normal file
@@ -0,0 +1,18 @@
|
||||
{{ $calendars := site.Data.schedule.calendars -}}
|
||||
{{- $list := slice -}}
|
||||
{{- range $room, $roomData := $calendars -}}
|
||||
{{- if ($roomData.ignore | default false) -}}{{ continue }}{{- end -}}
|
||||
{{- $roomName := $roomData.name | default $room -}}
|
||||
{{/* warnf "%s " $room */}}
|
||||
{{- range $roomData.schedule -}}
|
||||
{{- $addData := dict "room" $roomName "roomId" $room "weight" 0 -}}
|
||||
{{- $addData = merge $addData . -}}
|
||||
{{/* warnf "%#v" $addData */}}
|
||||
{{- $list = $list | append $addData -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $list = sort $list "start" -}}
|
||||
{{- $list = sort $list "title" -}}
|
||||
{{- $list = sort $list "weight" -}}
|
||||
{{/* warnf "%#v" $list */}}
|
||||
{{- return $list -}}
|
||||
118
themes/tsc_vfl/layouts/shortcodes/tsc/calendar/schedule.html
Normal file
118
themes/tsc_vfl/layouts/shortcodes/tsc/calendar/schedule.html
Normal file
@@ -0,0 +1,118 @@
|
||||
{{- $start := .Get 0 -}}
|
||||
{{- $end := .Get 1 -}}
|
||||
{{- $days := after 2 .Params -}}
|
||||
{{- $numDays := len $days -}}
|
||||
{{- $calendar := $.Site.Data.calendar.calendar -}}
|
||||
{{- $listSchedule := partialCached "tsc/calendar/list" . }}
|
||||
<div class="calendar-schedule calendar-grid-{{ $numDays }}-days">
|
||||
<div class="header">
|
||||
<div class="first-row"></div>
|
||||
{{ range $days }}
|
||||
<div class="first-row">{{ . }}</div>
|
||||
{{ end }}
|
||||
<div class="first-row"></div>
|
||||
<div class="second-row"></div>
|
||||
{{ range $days }}
|
||||
<div class="rooms second-row">
|
||||
<div>Vorne</div>
|
||||
<div>Mitte</div>
|
||||
<div>Hinten</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
<div class="second-row"></div>
|
||||
</div>
|
||||
<div class="times">
|
||||
{{ range (seq $start $end) }}
|
||||
<div>{{ printf "%2d:00" . }}</div>
|
||||
<div>{{ printf "%2d:00" . }}</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ range $id, $day := $days }}
|
||||
<div class="cal-main-content day-{{$id}}">
|
||||
{{ range $listSchedule }}
|
||||
{{- if ne .day $day }}{{ continue }}{{ end }}
|
||||
{{- $sTime := time.AsTime (printf "2025-01-02T%s:00" .start) -}}
|
||||
{{- $hours := int ($sTime.Format "15") -}}
|
||||
{{- $minutes := int ($sTime.Format "4") -}}
|
||||
{{/* warnf "%T" $hours */}}
|
||||
{{ $hours = add $hours (sub 0 $start) (div $minutes 60.0) }}
|
||||
{{/* print $hours */}}
|
||||
{{/* $hours = $hours - 0 + ($minutes / 60.0) */}}
|
||||
{{- $top := mul $hours 60 -}}
|
||||
{{- $height := mul (div .duration 60.0) 60 -}}
|
||||
{{- $style := printf "top: %1.0fpx; height: %1.0fpx;" $top $height -}}
|
||||
{{/* warnf "%s" $style */}}
|
||||
<div class="event room-{{ .roomId }}" style="{{ $style | safeCSS }}">
|
||||
<div>
|
||||
{{ .title }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
<div class="background">
|
||||
{{ range $idx, $val := (seq $start $end)}}
|
||||
<div class="hor-line" style="grid-row-start: calc({{$idx}} + 1);"></div>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
<table class="calendar-manual">
|
||||
<tr>
|
||||
<th></th>
|
||||
{{ range $days }}
|
||||
<th colspan="3" class="day-title">{{ . }}</th>
|
||||
{{ end }}
|
||||
<th></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
{{ range $days }}
|
||||
<th class="first-col-of-room">vorne</th>
|
||||
<th>mitte</th>
|
||||
<th>hinten</th>
|
||||
{{ end }}
|
||||
<th></th>
|
||||
</tr>
|
||||
{{ range seq $start $end }}
|
||||
{{ $hour := . }}
|
||||
{{ range seq 0 15 45 }}
|
||||
{{ $firstMin := "" }}
|
||||
{{ if eq . 0 }}
|
||||
{{ $firstMin = "first-min" }}
|
||||
{{ end }}
|
||||
<tr class="{{ $firstMin }}">
|
||||
{{ $time := printf "%2d:%02d" $hour . }}
|
||||
{{ if or (eq . 0) (eq . 30) }}
|
||||
<td rowspan="2" class="time">{{ $time }}</td>
|
||||
{{ end }}
|
||||
{{ range $days }}
|
||||
{{ $day := . }}
|
||||
{{ $firstRoom := true }}
|
||||
{{ range slice "vorne" "mitte" "hinten" }}
|
||||
{{ $room := . }}
|
||||
{{ $addClass := "" }}
|
||||
{{ if $firstRoom }}
|
||||
{{ $addClass = "first-col-of-room" }}
|
||||
{{ $firstRoom = false }}
|
||||
{{ end }}
|
||||
{{ with index (index (index $calendar .) $day) $time }}
|
||||
<td class="calendar-block {{ $addClass }}">
|
||||
<div class="calendar-block-entity height-{{ .slots }}">
|
||||
<div class="room-block room-{{ $room }}">
|
||||
{{ .title }}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
{{ else }}
|
||||
<td class="{{ $addClass }}"></td>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ if or (eq . 0) (eq . 30) }}
|
||||
{{ $time := printf "%2d.%02d" $hour . }}
|
||||
<td rowspan="2" class="time">{{ $time }}</td>
|
||||
{{ end }}
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</table>
|
||||
@@ -1,23 +1,7 @@
|
||||
{{ $calendars := .Site.Data.schedule.calendars -}}
|
||||
{{- $list := slice -}}
|
||||
{{- range $room, $roomData := $calendars -}}
|
||||
{{- if ($roomData.ignore | default false) -}}{{ continue }}{{- end -}}
|
||||
{{- $roomName := $roomData.name | default $room -}}
|
||||
{{/* warnf "%s " $room */}}
|
||||
{{- range $roomData.schedule -}}
|
||||
{{- $addData := dict "room" $roomName "weight" 0 -}}
|
||||
{{- $addData = merge $addData . -}}
|
||||
{{/* warnf "%#v" $addData */}}
|
||||
{{- $list = $list | append $addData -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $list := partialCached "tsc/calendar/list" . -}}
|
||||
{{- $cat := .Get "category" -}}
|
||||
{{/* warnf "%#v" $cat */}}
|
||||
{{- $showAge := .Get "showAge" | default false -}}
|
||||
{{- $list = sort $list "start" -}}
|
||||
{{- $list = sort $list "title" -}}
|
||||
{{- $list = sort $list "weight" -}}
|
||||
{{/* warnf "%#v" $list */}}
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user