diff options
author | Arthur Zamarin <arthurzam@gentoo.org> | 2023-03-10 08:47:28 +0200 |
---|---|---|
committer | Arthur Zamarin <arthurzam@gentoo.org> | 2023-03-10 08:47:28 +0200 |
commit | 2a68392c1fd194a7d885ee4997f6c82ded663ebd (patch) | |
tree | f2dec0e1b79ffba6844fea188040ca168549b066 /web/templates/maintainer/components/packages.tmpl | |
parent | app/maintainer: simplify changelog's commits slice (diff) | |
download | soko-2a68392c1fd194a7d885ee4997f6c82ded663ebd.tar.gz soko-2a68392c1fd194a7d885ee4997f6c82ded663ebd.tar.bz2 soko-2a68392c1fd194a7d885ee4997f6c82ded663ebd.zip |
web/maintainer/packages: fix issue when no packages
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'web/templates/maintainer/components/packages.tmpl')
-rw-r--r-- | web/templates/maintainer/components/packages.tmpl | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/web/templates/maintainer/components/packages.tmpl b/web/templates/maintainer/components/packages.tmpl index e2ab60d..6ad7e19 100644 --- a/web/templates/maintainer/components/packages.tmpl +++ b/web/templates/maintainer/components/packages.tmpl @@ -115,27 +115,29 @@ </dl> </div> {{end}} - <h4 class="{{if .Maintainer.Project.Description}}mt-4{{end}}"> - <a class="collapseLink" style="color:#000000;" data-toggle="collapse" href="#collapseShortcuts" role="button" aria-expanded="false" aria-controls="collapseShortcuts"> - Shortcuts - </a> - </h4> - <div class="collapse show" id="collapseShortcuts"> - <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> + {{if .Packages}} + <h4 class="{{if .Maintainer.Project.Description}}mt-4{{end}}"> + <a class="collapseLink" style="color:#000000;" data-toggle="collapse" href="#collapseShortcuts" role="button" aria-expanded="false" aria-controls="collapseShortcuts"> + Shortcuts + </a> + </h4> + <div class="collapse show" id="collapseShortcuts"> + <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> + {{end}} </div> </div> {{end}} |