Update: unit-choice.html

This commit is contained in:
hyzen
2026-04-11 19:58:46 +05:30
parent 08825eb17f
commit 3826fc059a
13 changed files with 23 additions and 371 deletions

View File

@@ -1,5 +1,4 @@
{{ define "main" }}
{{/* Get semester and subjectcode from child pages since _index.md doesn't carry taxonomy params */}}
{{ $semester := "" }}
{{ $subjectcode := "" }}
@@ -13,7 +12,6 @@
{{ $subjectcode = cond (reflect.IsSlice $raw) (index $raw 0) $raw }}
{{ end }}
{{ end }}
<nav class="uninotes-breadcrumbs breadcrumbs">
<a href="/uninotes/">UniNotes</a>
{{ if $semester }}
@@ -30,32 +28,36 @@
{{ end }}
<span>{{ .Params.unit | default .Title }}</span>
</nav>
<div class="uninotes-meta">
{{ with $semester }}<span class="uninotes-meta__pill">{{ . }}</span>{{ end }}
{{ with $subjectcode }}<span class="uninotes-meta__pill">{{ . }}</span>{{ end }}
</div>
<h1>{{ .Params.unit | default .Title }}</h1>
<p class="unit-choice__subtitle">Choose type:</p>
{{/* Check if a live page exists at the expected URL */}}
{{/* Check if self/live pages exist */}}
{{ $hasSelf := false }}
{{ $hasLive := false }}
{{ range .Pages }}
{{ if eq (lower .Params.notecategory) "self" }}{{ $hasSelf = true }}{{ end }}
{{ if eq (lower .Params.notecategory) "live" }}{{ $hasLive = true }}{{ end }}
{{ end }}
<div class="unit-choice__options">
{{ if $hasSelf }}
<a class="unit-choice__card unit-choice__card--self" href="{{ .RelPermalink }}self/">
{{ else }}
<div class="unit-choice__card unit-choice__card--self unit-choice__card--unavailable">
{{ end }}
<div class="unit-choice__icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="32" height="32" fill="currentColor">
<path d="M12 3L1 9l4 2.18v6L12 21l7-3.82v-6l2-1.09V17h2V9L12 3zm6.82 6L12 12.72 5.18 9 12 5.28 18.82 9zM17 15.99l-5 2.73-5-2.73v-3.72L12 15l5-2.73v3.72z"/>
</svg>
</div>
<div class="unit-choice__label">Self</div>
<div class="unit-choice__desc">Self-study notes</div>
</a>
<div class="unit-choice__desc">
{{ if $hasSelf }}Self-study notes
{{ else }}Not available{{ end }}
</div>
{{ if $hasSelf }}</a>{{ else }}</div>{{ end }}
{{ if $hasLive }}
<a class="unit-choice__card unit-choice__card--live" href="{{ .RelPermalink }}live/">
@@ -70,9 +72,8 @@
<div class="unit-choice__label">Live</div>
<div class="unit-choice__desc">
{{ if $hasLive }}Live class notes
{{ else }}Coming soon{{ end }}
{{ else }}Not available{{ end }}
</div>
{{ if $hasLive }}</a>{{ else }}</div>{{ end }}
</div>
{{ end }}