| 1 | {{define "title"}}{{.Title}}{{end}} |
| 2 | {{define "main"}} |
| 3 | {{/* cal-view: the one width every view shares (calendar.css). */}} |
| 4 | <main rst-page cal-view id="main"> |
| 5 | <header rst-page-header> |
| 6 | <div rst-page-header-titles> |
| 7 | <h1>{{.Title}}</h1> |
| 8 | </div> |
| 9 | {{/* Quick add sits BESIDE New event, not instead of it. The |
| 10 | sentence is the fast path; the form is the one that shows |
| 11 | every field, and neither is a lesser version of the other. */}} |
| 12 | <div cal-header-actions> |
| 13 | {{template "quickadd" .}} |
| 14 | <a rst-btn="primary" href="/events/new">New event</a> |
| 15 | </div> |
| 16 | </header> |
| 17 | |
| 18 | {{template "calendar-toolbar" (dict "View" "week" "Noun" "week" "Prev" (printf "/week/%s" .Data.PrevISO) "Today" (printf "/week/%s" .Data.TodayISO) "Next" (printf "/week/%s" .Data.NextISO) "Day" (printf "/day/%s" .Data.StartISO) "Week" (printf "/week/%s" .Data.StartISO) "Month" (printf "/month/%s?date=%s" (slice .Data.StartISO 0 7) .Data.StartISO) "Agenda" (printf "/agenda?from=%s" .Data.StartISO))}} |
| 19 | |
| 20 | {{/* The week keeps its two dimensions on a phone and scrolls sideways. |
| 21 | Flattening it to a list would make it the agenda, which already |
| 22 | exists and is better at being a list. */}} |
| 23 | <div cal-week-scroll> |
| 24 | {{/* Row by row, not column by column: the headers, then ONE all-day |
| 25 | row across the whole week, then the timed grid. When each day |
| 26 | carried its own all-day strip, a day with a birthday pushed its |
| 27 | hour column down and its 10:00 meeting drew beside the 11:00 |
| 28 | label. As rows of one grid, every timed column starts at the |
| 29 | same height whatever sits above it. */}} |
| 30 | <div cal-week-grid> |
| 31 | <div cal-column-head> </div> |
| 32 | {{range .Data.Days}} |
| 33 | <div cal-column-head="{{if eq .ISO $.Data.TodayISO}}today{{end}}"> |
| 34 | <a href="/day/{{.ISO}}">{{.Date.Format "Mon 2"}}</a> |
| 35 | {{if eq .ISO $.Data.TodayISO}}<span class="rst-sr-only">(today)</span>{{end}} |
| 36 | </div> |
| 37 | {{end}} |
| 38 | |
| 39 | {{if .Data.AnyAllDay}} |
| 40 | <div cal-allday-label>All day</div> |
| 41 | {{range .Data.Days}} |
| 42 | <div cal-allday="week">{{range .AllDay}}{{template "chip" .}}{{end}}</div> |
| 43 | {{end}} |
| 44 | {{end}} |
| 45 | |
| 46 | <div cal-hours> |
| 47 | {{range (index .Data.Days 0).Hours}}<div cal-hour{{if eq . "08:00"}} cal-working-hour{{end}}>{{.}}</div>{{end}} |
| 48 | </div> |
| 49 | {{range .Data.Days}} |
| 50 | <div cal-column> |
| 51 | <div cal-column-rules aria-hidden="true"></div> |
| 52 | {{range .Slots}} |
| 53 | <a cal-slot href="{{.Href}}" style="top:{{.TopPct}}%;height:{{.HeightPct}}%"> |
| 54 | <span class="rst-sr-only">{{.Label}}</span> |
| 55 | </a> |
| 56 | {{end}} |
| 57 | {{range .Placed}} |
| 58 | <div cal-placed="{{if .Short}}short{{end}}" style="top:{{.TopPct}}%;height:{{.HeightPct}}%;left:{{.LeftPct}}%;width:{{.WidthPct}}%"> |
| 59 | {{template "chip" .Chip}} |
| 60 | </div> |
| 61 | {{end}} |
| 62 | </div> |
| 63 | {{end}} |
| 64 | </div> |
| 65 | </div> |
| 66 | </main> |
| 67 | {{end}} |
| 68 | {{define "content"}}{{end}} |
| 69 | |