update: add the package page

This commit is contained in:
ngn
2024-08-13 22:12:27 +03:00
parent a556ed08aa
commit aa0b373423
8 changed files with 345 additions and 43 deletions

View File

@ -9,27 +9,36 @@
<body>
{{template "parts/bar" .}}
<main>
<div class="search">
<form action="/" method="GET">
{{if .query}}
<input placeholder="Hit enter to search" type="text" name="q" value="{{.query}}">
{{else}}
<input placeholder="Hit enter to search" type="text" name="q" autofocus>
{{end}}
<form action="/" method="GET">
<div class="options">
<select name="pools">
<option value="">Select pool</option>
{{range .pools}}
<option value="{{.Name}}">{{.Display}}</option>
{{end}}
</select>
</form>
<div class="status">
<p>Listing {{len .list}} packages</p>
<p>Last updated: {{.last}}</p>
<div class="checkbox">
<input type="checkbox" name="exact" value="1">
<label>Only show exact matches</label>
</div>
<div class="checkbox">
<input type="checkbox" name="json" value="1">
<label>Show results as JSON</label>
</div>
</div>
</div>
<table class="pkgs">
<div class="search">
{{if .query}}
<input placeholder="Hit enter to search" type="text" name="q" value="{{.query}}">
{{else}}
<input placeholder="Hit enter to search" type="text" name="q" autofocus>
{{end}}
<div class="status">
<p>Listing {{len .list}} packages</p>
<p>Last updated: {{.last}}</p>
</div>
</div>
</form>
<table class="list">
<tr>
<th>Name</th>
<th>Pool</th>
@ -40,7 +49,7 @@
</tr>
{{range .list}}
<tr>
<td><a href="{{.URL}}">{{.Name}}</a></td>
<td><a href="/p/{{.Name}}/{{.Version}}">{{.Name}}</a></td>
{{if .Pool}}
<td>{{.Pool.Display}}</td>
{{else}}

60
templates/package.html Normal file
View File

@ -0,0 +1,60 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>MatterLinux | {{.Name}} {{.Version}}</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=1200">
<link href="/style.css" rel="stylesheet">
</head>
<body>
{{template "parts/bar" .}}
<main class="package-main">
<div class="detail">
<h3>Package details</h3>
<div class="links">
<a href="{{.URL}}">View source</a>
<a href="/p/{{.Name}}/{{.Version}}?download=1">Download archive</a>
</div>
</div>
<table class="package">
<tr class="package-name">
<th>Name</th>
<th>{{.Name}}</th>
</tr>
<tr>
<th>Version</th>
<th>{{.Version}}</th>
</tr>
<tr>
<th>Size</th>
<th>{{.Size}}</th>
</tr>
<tr>
<th>Description</th>
<th>{{.Desc}}</th>
</tr>
{{if .Depends}}
<tr>
<th>Dependencies</th>
<th>
{{range .Depends}}
<a href="/p/{{.}}/ANY">{{.}}</a>
{{end}}
</th>
</tr>
{{end}}
{{$files := .Files}}
{{if $files}}
<tr>
<th>Files</th>
<th>
{{range $files}}
<p>/{{.}}</p>
{{end}}
</th>
</tr>
{{end}}
</table>
</main>
</body>
</html>