aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2023-02-25 09:05:42 +0200
committerArthur Zamarin <arthurzam@gentoo.org>2023-02-25 16:54:15 +0200
commitbca1966c53ae6cf5c6f6028dd4866c85ac385852 (patch)
tree2f7cd84f2d49e65131affb1bbc82e4414bad491a /web
parentupdater/repology: collect outdated info per category (diff)
downloadsoko-bca1966c53ae6cf5c6f6028dd4866c85ac385852.tar.gz
soko-bca1966c53ae6cf5c6f6028dd4866c85ac385852.tar.bz2
soko-bca1966c53ae6cf5c6f6028dd4866c85ac385852.zip
categories: split packages into a separate template
This is preparation work for adding more tabs to the category page. I've also optimized the template whitespaces situation a bit, so that the generated HTML is a bit more compact. Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'web')
-rw-r--r--web/templates/categories/components/packages.tmpl50
-rw-r--r--web/templates/categories/packageline.tmpl6
-rw-r--r--web/templates/categories/show.tmpl55
3 files changed, 54 insertions, 57 deletions
diff --git a/web/templates/categories/components/packages.tmpl b/web/templates/categories/components/packages.tmpl
new file mode 100644
index 0000000..de64c60
--- /dev/null
+++ b/web/templates/categories/components/packages.tmpl
@@ -0,0 +1,50 @@
+{{- define "packages" -}}
+ <div class="row">
+ <div class="col-12">
+ <div class="row">
+ <div class="col-md-9">
+ <!--<p>
+ <input type="text" class="form-control form-control-xl" placeholder="Search packages in <%= @category.name %>">
+ </p>-->
+
+ <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}}">
+ {{- else -}}
+ <tr>
+ {{- end -}}
+ <th class="kk-nobreak-cell"><a href="/packages/{{.Atom}}">{{.Name}}</a></th>
+ <td>{{ (index .Versions 0).Description }}</td>
+ </tr>
+ {{- end -}}
+ </table>
+ </div>
+ </div>
+ <div class="col-md-3">
+ <h4>Statistics</h4>
+ <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>
+
+
+ </div>
+ </div>
+{{- end -}}
+
diff --git a/web/templates/categories/packageline.tmpl b/web/templates/categories/packageline.tmpl
deleted file mode 100644
index 64a10df..0000000
--- a/web/templates/categories/packageline.tmpl
+++ /dev/null
@@ -1,6 +0,0 @@
-{{define "packageline"}}
- <tr>
- <th class="kk-nobreak-cell"><a href="/packages/{{.Atom}}">{{.Name}}</a></th>
- <td>{{ (index .Versions 0).Description }}</td>
- </tr>
-{{end}}
diff --git a/web/templates/categories/show.tmpl b/web/templates/categories/show.tmpl
index 51c48de..bedde10 100644
--- a/web/templates/categories/show.tmpl
+++ b/web/templates/categories/show.tmpl
@@ -9,60 +9,13 @@
<div class="tab-content" id="myTabContent">
-
-<div class="container mb-5">
- <div class="row">
- <div class="col-12">
-
-
- <div class="row">
- <div class="col-md-9">
- <!--<p>
- <input type="text" class="form-control form-control-xl" placeholder="Search packages in <%= @category.name %>">
- </p>-->
-
- <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>
- </div>
- </div>
- <div class="col-md-3">
- <h4>Statistics</h4>
- <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>
-
-
- </div>
+ <div class="container mb-5 tab-pane fade show active" id="overview" role="tabpanel" aria-labelledby="overview-tab">
+ {{if eq .PageName "packages"}}
+ {{template "packages" .}}
+ {{end}}
</div>
</div>
-
-
-</div>
-
-
{{template "footer" .Application }}
</body>