summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorLibravatar Anirudh Oppiliappan <x@icyphox.sh>2022-12-12 21:33:09 +0530
committerLibravatar Anirudh Oppiliappan <x@icyphox.sh>2022-12-12 21:33:09 +0530
commit01f27147baf80e2222927ddca9369c7d99b4ff3c (patch)
treeffd8f1431f83ae4f1b390c907ee45c377c84f436 /templates
parent82b8afe19b77fe02e1a29a5b5e20882d8e5c3fc5 (diff)
downloadlegit-01f27147baf80e2222927ddca9369c7d99b4ff3c.tar.gz
legit-01f27147baf80e2222927ddca9369c7d99b4ff3c.tar.bz2
legit-01f27147baf80e2222927ddca9369c7d99b4ff3c.zip
routes: index view
Diffstat (limited to 'templates')
-rw-r--r--templates/500.html2
-rw-r--r--templates/index.html27
-rw-r--r--templates/nav.html4
-rw-r--r--templates/repo.html2
4 files changed, 33 insertions, 2 deletions
diff --git a/templates/500.html b/templates/500.html
index 5495d31..72e784c 100644
--- a/templates/500.html
+++ b/templates/500.html
@@ -1,7 +1,7 @@
{{ define "500" }}
<html>
<title>500</title>
-{{ template "header" . }}
+{{ template "head" . }}
<body>
500 &mdash; something broke!
</body>
diff --git a/templates/index.html b/templates/index.html
new file mode 100644
index 0000000..91f18b7
--- /dev/null
+++ b/templates/index.html
@@ -0,0 +1,27 @@
+{{ define "index" }}
+<html>
+{{ template "head" . }}
+
+ <header>
+ <h1>{{ .meta.Title }}</h1>
+ <h2>{{ .meta.Description }}</h2>
+ </header>
+ <body>
+ {{ template "nav" . }}
+ <main>
+ <table>
+ <tr>
+ <td>repository</td>
+ <td>last active</td>
+ </tr>
+ {{ range $repo, $lc := .info }}
+ <tr>
+ <td><a href="/{{ $repo }}">{{ $repo }}</a></td>
+ <td>{{ $lc }}</td>
+ </tr>
+ {{ end }}
+ </table>
+ </main>
+ </body>
+</html>
+{{ end }}
diff --git a/templates/nav.html b/templates/nav.html
index 20dca50..a8fa84a 100644
--- a/templates/nav.html
+++ b/templates/nav.html
@@ -2,9 +2,13 @@
<nav>
<ul>
<li><a href="/">all repos</a>
+ {{ if .name }}
<li><a href="/{{ .name }}">{{ .name }}</a>
+ {{ end }}
+ {{ if .ref }}
<li><a href="/{{ .name }}/tree/{{ .ref }}/">tree</a>
<li><a href="/{{ .name }}/log/{{ .ref }}">log</a>
+ {{ end }}
</ul>
</nav>
{{ end }}
diff --git a/templates/repo.html b/templates/repo.html
index a033f0d..ddc3f01 100644
--- a/templates/repo.html
+++ b/templates/repo.html
@@ -37,7 +37,7 @@
{{ if $parent }}
<a href="/{{ $repo }}/tree/{{ $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}/</a>
{{ else }}
- <a href="{{ $repo }}/tree/{{ $ref }}/{{ .Name }}">{{ .Name }}/</a>
+ <a href="/{{ $repo }}/tree/{{ $ref }}/{{ .Name }}">{{ .Name }}/</a>
{{ end }}
</td>
</tr>