aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2023-03-03 10:05:52 +0200
committerArthur Zamarin <arthurzam@gentoo.org>2023-03-03 10:05:52 +0200
commit41321fc5ba407ffe848e4b10e0e2cbff7f2f8b81 (patch)
treeaa67b52b77e9cf74172a356a368d5133aec00de0 /web
parentcategories: add pull requests tab (diff)
downloadsoko-41321fc5ba407ffe848e4b10e0e2cbff7f2f8b81.tar.gz
soko-41321fc5ba407ffe848e4b10e0e2cbff7f2f8b81.tar.bz2
soko-41321fc5ba407ffe848e4b10e0e2cbff7f2f8b81.zip
categories: fix package filter table repeats
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'web')
-rw-r--r--web/templates/categories/components/packages.tmpl13
1 files changed, 6 insertions, 7 deletions
diff --git a/web/templates/categories/components/packages.tmpl b/web/templates/categories/components/packages.tmpl
index de64c60..f142ec8 100644
--- a/web/templates/categories/components/packages.tmpl
+++ b/web/templates/categories/components/packages.tmpl
@@ -9,10 +9,10 @@
<div class="card border-top-0 rounded">
<table class="table mb-0 rounded">
- {{$prevCatLetter := (printf "%.1s" (index .Category.Packages 0).Name) }}
+ {{$prevCatLetter := "" }}
{{- range .Category.Packages -}}
- {{- if ne (printf "%.1s" .Name) $prevCatLetter -}}
- {{- $prevCatLetter = (printf "%.1s" .Name) -}}
+ {{- if ne (packageLetter .Name) $prevCatLetter -}}
+ {{- $prevCatLetter = (packageLetter .Name) -}}
<tr id="{{$prevCatLetter}}">
{{- else -}}
<tr>
@@ -31,14 +31,13 @@
</dd>
<h4 class="mt-4">Filter by Category</h4>
<div class="row pl-4 pr-5 mr-5">
- {{- $prevLetter := (printf "%.1s" (index .Category.Packages 0).Name) -}}
+ {{- $prevLetter := "" -}}
{{- range .Category.Packages -}}
- {{- if ne (printf "%.1s" .Name) $prevLetter -}}
+ {{- if ne (packageLetter .Name) $prevLetter -}}
+ {{- $prevLetter = (packageLetter .Name) -}}
<div class="col-md-2 px-2"><a href="#{{$prevLetter}}" class="text-muted text-capitalize">{{$prevLetter}}</a></div>
- {{- $prevLetter = (printf "%.1s" .Name) -}}
{{- end -}}
{{- end -}}
- <div class="col-md-2 px-2"><a href="#{{$prevLetter}}" class="text-muted text-capitalize">{{$prevLetter}}</a></div>
</div>
</div>
</div>