Fix: login/signup forms. Update: code formating

This commit is contained in:
hyzen
2026-06-04 23:38:05 +05:30
parent cb0d929f7a
commit 16255bb690
63 changed files with 1544 additions and 1146 deletions

View File

@@ -13,43 +13,116 @@
<img src="/logo.png" alt="Freedoms4 logo" />
<h1>Freedoms4</h1>
<div class="brand__actions">
<button class="theme-toggle" id="theme-toggle" aria-label="Toggle theme" title="Toggle dark/light mode">
<svg class="theme-toggle__sun" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><path d="M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zM2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1zm18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41L5.99 4.58zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41l-1.06-1.06zm1.06-12.37l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06c.39-.39.39-1.03 0-1.41s-1.03-.39-1.41 0zM7.05 18.36l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06c.39-.39.39-1.03 0-1.41s-1.03-.39-1.41 0z"/></svg>
<svg class="theme-toggle__moon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><path d="M21 12.79A9 9 0 1 1 11.21 3a7 7 0 0 0 9.79 9.79z"/></svg>
<button
class="theme-toggle"
id="theme-toggle"
aria-label="Toggle theme"
title="Toggle dark/light mode"
>
<svg
class="theme-toggle__sun"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width="16"
height="16"
fill="currentColor"
>
<path
d="M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zM2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1zm18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41L5.99 4.58zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41l-1.06-1.06zm1.06-12.37l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06c.39-.39.39-1.03 0-1.41s-1.03-.39-1.41 0zM7.05 18.36l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06c.39-.39.39-1.03 0-1.41s-1.03-.39-1.41 0z"
/>
</svg>
<svg
class="theme-toggle__moon"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width="16"
height="16"
fill="currentColor"
>
<path d="M21 12.79A9 9 0 1 1 11.21 3a7 7 0 0 0 9.79 9.79z" />
</svg>
</button>
<!-- Desktop: account + subscribe -->
<div class="brand__auth brand__auth--desktop">
<input type="checkbox" id="auth-dropdown" class="brand__auth-check" />
<label class="brand__auth-toggle" for="auth-dropdown" tabindex="0" aria-label="Account options">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="12" height="12" fill="currentColor"><path d="M12 12c2.7 0 4.8-2.1 4.8-4.8S14.7 2.4 12 2.4 7.2 4.5 7.2 7.2 9.3 12 12 12zm0 2.4c-3.2 0-9.6 1.6-9.6 4.8v2.4h19.2v-2.4c0-3.2-6.4-4.8-9.6-4.8z"/></svg>
<label
class="brand__auth-toggle"
for="auth-dropdown"
tabindex="0"
aria-label="Account options"
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width="12"
height="12"
fill="currentColor"
>
<path
d="M12 12c2.7 0 4.8-2.1 4.8-4.8S14.7 2.4 12 2.4 7.2 4.5 7.2 7.2 9.3 12 12 12zm0 2.4c-3.2 0-9.6 1.6-9.6 4.8v2.4h19.2v-2.4c0-3.2-6.4-4.8-9.6-4.8z"
/>
</svg>
</label>
<div class="brand__auth-links">
<a href="/login/" class="auth-link auth-link--login">Login</a>
<a href="/signup/" class="auth-link auth-link--signup">Sign Up</a>
</div>
</div>
{{- $rssURL := "/index.xml" -}}
{{- with .OutputFormats.Get "rss" -}}
{{- $rssURL = .RelPermalink -}}
{{- end -}}
<a href="{{ $rssURL }}" class="rss-subscribe__link rss-subscribe__link--desktop" title="Subscribe via RSS">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="10" height="10" fill="currentColor" aria-hidden="true">
<path d="M6.18 15.64a2.18 2.18 0 0 1 2.18 2.18C8.36 19.01 7.38 20 6.18 20C4.98 20 4 19.01 4 17.82a2.18 2.18 0 0 1 2.18-2.18M4 4.44A15.56 15.56 0 0 1 19.56 20h-2.83A12.73 12.73 0 0 0 4 7.27V4.44m0 5.66a9.9 9.9 0 0 1 9.9 9.9h-2.83A7.07 7.07 0 0 0 4 12.93V10.1z"/>
{{- $rssURL := "/index.xml" -}} {{- with .OutputFormats.Get "rss" -}} {{-
$rssURL = .RelPermalink -}} {{- end -}}
<a
href="{{ $rssURL }}"
class="rss-subscribe__link rss-subscribe__link--desktop"
title="Subscribe via RSS"
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width="10"
height="10"
fill="currentColor"
aria-hidden="true"
>
<path
d="M6.18 15.64a2.18 2.18 0 0 1 2.18 2.18C8.36 19.01 7.38 20 6.18 20C4.98 20 4 19.01 4 17.82a2.18 2.18 0 0 1 2.18-2.18M4 4.44A15.56 15.56 0 0 1 19.56 20h-2.83A12.73 12.73 0 0 0 4 7.27V4.44m0 5.66a9.9 9.9 0 0 1 9.9 9.9h-2.83A7.07 7.07 0 0 0 4 12.93V10.1z"
/>
</svg>
<span>Subscribe</span>
</a>
<!-- Mobile: combined dropdown -->
<div class="brand__mobile-menu">
<input type="checkbox" id="mobile-menu-check" class="brand__mobile-check" />
<label class="brand__mobile-toggle" for="mobile-menu-check" aria-label="Menu">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="18" height="18" fill="currentColor"><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"/></svg>
<label
class="brand__mobile-toggle"
for="mobile-menu-check"
aria-label="Menu"
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width="18"
height="18"
fill="currentColor"
>
<path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z" />
</svg>
</label>
<div class="brand__mobile-links">
<a href="/login/" class="mobile-link">Login</a>
<a href="/signup/" class="mobile-link">Sign Up</a>
<a href="{{ $rssURL }}" class="mobile-link mobile-link--subscribe">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="12" height="12" fill="currentColor" aria-hidden="true"><path d="M6.18 15.64a2.18 2.18 0 0 1 2.18 2.18C8.36 19.01 7.38 20 6.18 20C4.98 20 4 19.01 4 17.82a2.18 2.18 0 0 1 2.18-2.18M4 4.44A15.56 15.56 0 0 1 19.56 20h-2.83A12.73 12.73 0 0 0 4 7.27V4.44m0 5.66a9.9 9.9 0 0 1 9.9 9.9h-2.83A7.07 7.07 0 0 0 4 12.93V10.1z"/></svg>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width="12"
height="12"
fill="currentColor"
aria-hidden="true"
>
<path
d="M6.18 15.64a2.18 2.18 0 0 1 2.18 2.18C8.36 19.01 7.38 20 6.18 20C4.98 20 4 19.01 4 17.82a2.18 2.18 0 0 1 2.18-2.18M4 4.44A15.56 15.56 0 0 1 19.56 20h-2.83A12.73 12.73 0 0 0 4 7.27V4.44m0 5.66a9.9 9.9 0 0 1 9.9 9.9h-2.83A7.07 7.07 0 0 0 4 12.93V10.1z"
/>
</svg>
Subscribe
</a>
</div>

View File

@@ -1,120 +1,57 @@
{{ define "main" }}
{{ $subjectCode := .Title }}
{{/* Get semester from first post */}}
{{ $semester := "" }}
{{ range .Pages }}
{{ if eq $semester "" }}
{{ $raw := .Params.semester }}
{{ if reflect.IsSlice $raw }}
{{ $semester = index $raw 0 }}
{{ else }}
{{ $semester = $raw }}
{{ end }}
{{ end }}
{{ end }}
{{ define "main" }} {{ $subjectCode := .Title }} {{/* Get semester from first post */}} {{ $semester
:= "" }} {{ range .Pages }} {{ if eq $semester "" }} {{ $raw := .Params.semester }} {{ if
reflect.IsSlice $raw }} {{ $semester = index $raw 0 }} {{ else }} {{ $semester = $raw }} {{ end }}
{{ end }} {{ end }}
<nav class="uninotes-breadcrumbs breadcrumbs">
<a href="/uninotes/">UniNotes</a>
{{ if $semester }}
{{ $semPage := site.GetPage (printf "/semester/%s" ($semester | urlize)) }}
{{ if $semPage }}
<a href="{{ $semPage.RelPermalink }}">{{ $semester }}</a>
{{ end }}
{{ end }}
<span>{{ $subjectCode }}</span>
<a href="/uninotes/">UniNotes</a>
{{ if $semester }} {{ $semPage := site.GetPage (printf "/semester/%s" ($semester | urlize)) }}
{{ if $semPage }} <a href="{{ $semPage.RelPermalink }}">{{ $semester }}</a> {{ end }} {{ end
}} <span>{{ $subjectCode }}</span>
</nav>
<h1>{{ $subjectCode }}</h1>
{{/* Collect unique unit labels and sort numerically */}}
{{ $seenUnits := slice }}
{{ $unitDicts := slice }}
{{ range .Pages }}
{{ $unitLabel := (.Params.unit | default .Title) }}
{{ if not (in $seenUnits $unitLabel) }}
{{ $seenUnits = $seenUnits | append $unitLabel }}
{{/* Extract unit number for numeric sort, e.g. "Unit 11" → 11 */}}
{{ $uParts := split $unitLabel " " }}
{{ $uLast := index $uParts (sub (len $uParts) 1) }}
{{ $uNumStr := "" }}
{{ range (split $uLast "") }}
{{ if ge . "0" }}{{ if le . "9" }}{{ $uNumStr = printf "%s%s" $uNumStr . }}{{ end }}{{ end }}
{{ end }}
{{ $uNum := int ($uNumStr | default "0") }}
{{ $unitDicts = $unitDicts | append (dict "label" $unitLabel "page" . "num" $uNum) }}
{{ end }}
{{ end }}
{{ $sortedUnitDicts := sort $unitDicts "num" }}
{{/* Collect unique unit labels and sort numerically */}} {{ $seenUnits := slice }} {{ $unitDicts :=
slice }} {{ range .Pages }} {{ $unitLabel := (.Params.unit | default .Title) }} {{ if not (in
$seenUnits $unitLabel) }} {{ $seenUnits = $seenUnits | append $unitLabel }} {{/* Extract unit number
for numeric sort, e.g. "Unit 11" → 11 */}} {{ $uParts := split $unitLabel " " }} {{ $uLast := index
$uParts (sub (len $uParts) 1) }} {{ $uNumStr := "" }} {{ range (split $uLast "") }} {{ if ge . "0"
}}{{ if le . "9" }}{{ $uNumStr = printf "%s%s" $uNumStr . }}{{ end }}{{ end }} {{ end }} {{ $uNum :=
int ($uNumStr | default "0") }} {{ $unitDicts = $unitDicts | append (dict "label" $unitLabel "page"
. "num" $uNum) }} {{ end }} {{ end }} {{ $sortedUnitDicts := sort $unitDicts "num" }}
<ul class="uninotes-list uninotes-list--units">
{{ range $sortedUnitDicts }}
<li class="uninotes-list__item">
<a class="uninotes-list__link" href="{{ .page.Params.uniturl }}">
{{ .label }}
</a>
</li>
{{ end }}
{{ range $sortedUnitDicts }}
<li class="uninotes-list__item">
<a class="uninotes-list__link" href="{{ .page.Params.uniturl }}"> {{ .label }} </a>
</li>
{{ end }}
</ul>
{{/* Subject prev/next — siblings in same semester, sorted numerically by code number */}}
{{ if $semester }}
{{ $semPage := site.GetPage (printf "/semester/%s" ($semester | urlize)) }}
{{ if $semPage }}
{{/* Collect unique subject codes */}}
{{ $siblingCodes := slice }}
{{ range $semPage.Pages }}
{{ $raw := .Params.subjectcode }}
{{ $code := "" }}
{{ if reflect.IsSlice $raw }}
{{ $code = index $raw 0 }}
{{ else }}
{{ $code = $raw }}
{{ end }}
{{ if and $code (not (in $siblingCodes $code)) }}
{{ $siblingCodes = $siblingCodes | append $code }}
{{ end }}
{{ end }}
{{/* Sort subject codes numerically by extracting the number (e.g. "BO DCM1109" → 1109) */}}
{{ $codeDicts := slice }}
{{ range $siblingCodes }}
{{ $code := . }}
{{ $parts := split $code " " }}
{{ $lastPart := index $parts (sub (len $parts) 1) }}
{{ $numStr := "" }}
{{ range (split $lastPart "") }}
{{ if ge . "0" }}{{ if le . "9" }}{{ $numStr = printf "%s%s" $numStr . }}{{ end }}{{ end }}
{{ end }}
{{ $num := int ($numStr | default "0") }}
{{ $codeDicts = $codeDicts | append (dict "code" $code "num" $num) }}
{{ end }}
{{ $sortedCodeDicts := sort $codeDicts "num" }}
{{ if gt (len $sortedCodeDicts) 1 }}
{{ $currentIdx := 0 }}
{{ range $i, $d := $sortedCodeDicts }}
{{ if eq $d.code $subjectCode }}{{ $currentIdx = $i }}{{ end }}
{{ end }}
<nav class="page-nav">
{{ if gt $currentIdx 0 }}
{{ $prevCode := (index $sortedCodeDicts (sub $currentIdx 1)).code }}
{{ $prevPage := site.GetPage (printf "/subjectcode/%s" ($prevCode | urlize)) }}
{{ if $prevPage }}
<a class="page-nav__previous-link" href="{{ $prevPage.RelPermalink }}">← {{ $prevCode }}</a>
{{ end }}
{{ end }}
{{ if lt $currentIdx (sub (len $sortedCodeDicts) 1) }}
{{ $nextCode := (index $sortedCodeDicts (add $currentIdx 1)).code }}
{{ $nextPage := site.GetPage (printf "/subjectcode/%s" ($nextCode | urlize)) }}
{{ if $nextPage }}
<a class="page-nav__next-link" href="{{ $nextPage.RelPermalink }}">{{ $nextCode }} →</a>
{{ end }}
{{ end }}
</nav>
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{/* Subject prev/next — siblings in same semester, sorted numerically by code number */}} {{ if
$semester }} {{ $semPage := site.GetPage (printf "/semester/%s" ($semester | urlize)) }} {{ if
$semPage }} {{/* Collect unique subject codes */}} {{ $siblingCodes := slice }} {{ range
$semPage.Pages }} {{ $raw := .Params.subjectcode }} {{ $code := "" }} {{ if reflect.IsSlice $raw }}
{{ $code = index $raw 0 }} {{ else }} {{ $code = $raw }} {{ end }} {{ if and $code (not (in
$siblingCodes $code)) }} {{ $siblingCodes = $siblingCodes | append $code }} {{ end }} {{ end }} {{/*
Sort subject codes numerically by extracting the number (e.g. "BO DCM1109" → 1109) */}} {{
$codeDicts := slice }} {{ range $siblingCodes }} {{ $code := . }} {{ $parts := split $code " " }} {{
$lastPart := index $parts (sub (len $parts) 1) }} {{ $numStr := "" }} {{ range (split $lastPart "")
}} {{ if ge . "0" }}{{ if le . "9" }}{{ $numStr = printf "%s%s" $numStr . }}{{ end }}{{ end }} {{
end }} {{ $num := int ($numStr | default "0") }} {{ $codeDicts = $codeDicts | append (dict "code"
$code "num" $num) }} {{ end }} {{ $sortedCodeDicts := sort $codeDicts "num" }} {{ if gt (len
$sortedCodeDicts) 1 }} {{ $currentIdx := 0 }} {{ range $i, $d := $sortedCodeDicts }} {{ if eq
$d.code $subjectCode }}{{ $currentIdx = $i }}{{ end }} {{ end }}
<nav class="page-nav">
{{ if gt $currentIdx 0 }} {{ $prevCode := (index $sortedCodeDicts (sub $currentIdx 1)).code }}
{{ $prevPage := site.GetPage (printf "/subjectcode/%s" ($prevCode | urlize)) }} {{ if $prevPage
}}
<a class="page-nav__previous-link" href="{{ $prevPage.RelPermalink }}">← {{ $prevCode }}</a>
{{ end }} {{ end }} {{ if lt $currentIdx (sub (len $sortedCodeDicts) 1) }} {{ $nextCode :=
(index $sortedCodeDicts (add $currentIdx 1)).code }} {{ $nextPage := site.GetPage (printf
"/subjectcode/%s" ($nextCode | urlize)) }} {{ if $nextPage }}
<a class="page-nav__next-link" href="{{ $nextPage.RelPermalink }}">{{ $nextCode }} →</a>
{{ end }} {{ end }}
</nav>
{{ end }} {{ end }} {{ end }} {{ end }}