Files
hugo-template/layouts/tools/section.html
2025-06-12 14:28:17 -06:00

144 lines
4.5 KiB
HTML

{{ define "main" }}
{{ $allPages := slice }}
{{ $sections := slice }}
{{ range .Pages }}
{{ if .IsSection }}
{{ $sections = $sections | append . }}
{{ range .Pages }}
{{ $allPages = $allPages | append . }}
{{ end }}
{{ else }}
{{ $allPages = $allPages | append . }}
{{ end }}
{{ end }}
{{ $sortedSections := sort $sections "LinkTitle" }}
{{ $sortedPages := sort $allPages "LinkTitle" }}
<h1>{{ .Title }}</h1>
{{ .Content }}
<section id="tools-list">
{{ if gt (len $sortedSections) 0 }}
<!-- <h2>Sections</h2> -->
<!-- <p>This list shows all sections, sorted alphabetically.</p> -->
<div id="link-list" style="align-items: left; justify-content: left;">
<ul>
{{ range $sortedSections }}
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
{{ end }}
</ul>
</div>
{{ end }}
{{ if eq (len $sortedPages) 0 }}
<div style="display: flex; align-items: center; gap: 8px; margin: 1rem 0;">
<span style="display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: rgb(225, 82, 225);"></span>
<span style="color: rgb(225, 82, 225); font-size: 1rem;">No Tools Found</span>
</div>
{{ end }}
<table id="taxonomy-table">
<thead>
<tr>
<th>Tool</th>
<!-- <th>License</th> -->
<th>Applications</th>
<th>Developers</th>
</tr>
</thead>
<tbody>
{{ range $sortedPages }}
<tr onclick="window.location='{{ .RelPermalink }}'" style="cursor:pointer;">
<td><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></td>
<td>
{{ $sep := "" }}
{{ range $key, $vals := .Params }}
{{ if (in (slice "applications") $key) }}
{{ $sep }}
{{ range $i, $val := $vals }}
{{ partial "term-link.html" (dict "name" $val "taxonomy" $key) }}
{{ end }}
{{ $sep = "; " }}
{{ end }}
{{ end }}
</td>
<td>
{{ $sep := "" }}
{{ range $key, $vals := .Params }}
{{ if (in (slice "developers") $key) }}
{{ $sep }}
{{ range $i, $val := $vals }}
{{ partial "term-link.html" (dict "name" $val "taxonomy" $key) }}
{{ end }}
{{ $sep = "; " }}
{{ end }}
{{ end }}
</td>
</tr>
{{ end }}
<!-- {{ range .Pages }}
{{ if .IsSection }}
{{ range .Pages }}
<tr onclick="window.location='{{ .RelPermalink }}'" style="cursor:pointer;">
<td><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></td>
<td>
{{ $sep := "" }}
{{ range $key, $vals := .Params }}
{{ if (in (slice "applications") $key) }}
{{ $sep }}
{{ range $i, $val := $vals }}
{{ partial "term-link.html" (dict "name" $val "taxonomy" $key) }}
{{ end }}
{{ $sep = "; " }}
{{ end }}
{{ end }}
</td>
<td>
{{ $sep := "" }}
{{ range $key, $vals := .Params }}
{{ if (in (slice "developers") $key) }}
{{ $sep }}
{{ range $i, $val := $vals }}
{{ partial "term-link.html" (dict "name" $val "taxonomy" $key) }}
{{ end }}
{{ $sep = "; " }}
{{ end }}
{{ end }}
</td>
</tr>
{{ end }}
{{ else }}
<tr onclick="window.location='{{ .RelPermalink }}'" style="cursor:pointer;">
<td><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></td>
<td>
{{ $sep := "" }}
{{ range $key, $vals := .Params }}
{{ if (in (slice "applications") $key) }}
{{ $sep }}
{{ range $i, $val := $vals }}
{{ partial "term-link.html" (dict "name" $val "taxonomy" $key) }}
{{ end }}
{{ $sep = "; " }}
{{ end }}
{{ end }}
</td>
<td>
{{ $sep := "" }}
{{ range $key, $vals := .Params }}
{{ if (in (slice "developers") $key) }}
{{ $sep }}
{{ range $i, $val := $vals }}
{{ partial "term-link.html" (dict "name" $val "taxonomy" $key) }}
{{ end }}
{{ $sep = "; " }}
{{ end }}
{{ end }}
</td>
</tr>
{{ end }}
{{ end }} -->
</tbody>
</table>
{{ end }}