aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorMax Magorsch <arzano@gentoo.org>2020-07-13 20:25:25 +0200
committerMax Magorsch <arzano@gentoo.org>2020-07-13 20:25:25 +0200
commit92f7e0c44a196f819e180eee74812ebe42024eb9 (patch)
tree9b34a42770c5781682c9c677096d63fb91e19cd7 /web
parentImprove the search for a maintainer (diff)
downloadsoko-92f7e0c44a196f819e180eee74812ebe42024eb9.tar.gz
soko-92f7e0c44a196f819e180eee74812ebe42024eb9.tar.bz2
soko-92f7e0c44a196f819e180eee74812ebe42024eb9.zip
Add next steps towards filtering lists
Signed-off-by: Max Magorsch <arzano@gentoo.org>
Diffstat (limited to 'web')
-rw-r--r--web/templates/categories/show.tmpl16
-rw-r--r--web/templates/maintainer/components/packages.tmpl65
2 files changed, 68 insertions, 13 deletions
diff --git a/web/templates/categories/show.tmpl b/web/templates/categories/show.tmpl
index fa3cfc2..51c48de 100644
--- a/web/templates/categories/show.tmpl
+++ b/web/templates/categories/show.tmpl
@@ -23,7 +23,12 @@
<div class="card border-top-0 rounded">
<table class="table mb-0 rounded">
+ {{$prevCatLetter := (printf "%.1s" (index .Category.Packages 0).Name) }}
{{range .Category.Packages}}
+ {{ if ne (printf "%.1s" .Name) $prevCatLetter}}
+ {{$prevCatLetter = (printf "%.1s" .Name)}}
+ <tr id="{{$prevCatLetter}}"></tr>
+ {{end}}
{{template "packageline" .}}
{{end}}
</table>
@@ -34,6 +39,17 @@
<dd class="ml-3">
<dl>Packages: {{ len .Category.Packages }}</dl>
</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) }}
+ {{ range .Category.Packages }}
+ {{ if ne (printf "%.1s" .Name) $prevLetter}}
+ <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>
diff --git a/web/templates/maintainer/components/packages.tmpl b/web/templates/maintainer/components/packages.tmpl
index afe853a..6e155d8 100644
--- a/web/templates/maintainer/components/packages.tmpl
+++ b/web/templates/maintainer/components/packages.tmpl
@@ -2,20 +2,44 @@
<div class="row">
<div class="col-md-9">
{{if .Packages}}
- <h3 class="mb-4">Packages</h3>
<ul class="list-group">
- {{range .Packages}}
- <li class="list-group-item">
- <div class="row">
- <div class="col-md-4">
- <a href="/packages/{{.Atom}}" class="text-dark"><b>{{.Atom}}</b></a>
- </div>
- <div class="col-md-8 text-muted">
- {{.Description}}
- </div>
- </div>
- </li>
- {{end}}
+ {{$category := ""}}
+
+ {{ range .Packages }}
+ {{ if eq .Category $category}}
+ <li class="list-group-item">
+ <div class="row">
+ <div class="col-md-4">
+ <a href="/packages/{{.Atom}}" class="text-dark"><b>{{.Atom}}</b></a>
+ </div>
+ <div class="col-md-8 text-muted">
+ {{.Description}}
+ </div>
+ </div>
+ </li>
+ {{$category = .Category}}
+ {{else}}
+ </ul>
+ <h3 id="{{.Category}}" class="{{if ne $category ""}}mt-4{{end}}">
+ {{$category = .Category}}
+ {{$category}}
+ </h3>
+ <ul class="list-group">
+ <li class="list-group-item">
+ <div class="row">
+ <div class="col-md-4">
+ <a href="/packages/{{.Atom}}" class="text-dark"><b>{{.Atom}}</b></a>
+ </div>
+ <div class="col-md-8 text-muted">
+ {{.Description}}
+ </div>
+ </div>
+ </li>
+ {{end}}
+ {{end}}
+
+
+
</ul>
{{else}}
@@ -33,6 +57,21 @@
<span class="text-muted">
All packages maintained by {{.Maintainer.Name}}. That is, {{.Maintainer.Name}} is mentioned as maintainer of the project in the <a href="https://devmanual.gentoo.org/ebuild-writing/misc-files/metadata/">metadata.xml</a> file
</span>
+ <h4 class="mt-4">Shortcuts</h4>
+ <dl>
+ {{$category := (index .Packages 0).Category}}
+ {{$packageCounter := 0}}
+ {{ range .Packages }}
+ {{ if ne .Category $category}}
+ <dd class="ml-3 mb-0"><a href="#{{$category}}">{{$category}} ({{$packageCounter}})</a></dd>
+ {{$category = .Category}}
+ {{$packageCounter = 1}}
+ {{else}}
+ {{$packageCounter = add $packageCounter 1}}
+ {{end}}
+ {{end}}
+ <dd class="ml-3 mb-0"><a href="#{{$category}}">{{$category}} ({{$packageCounter}})</a></dd>
+ </dl>
</div>
</div>
{{end}}