diff options
author | Anirudh Oppiliappan <x@icyphox.sh> | 2022-12-11 21:17:04 +0530 |
---|---|---|
committer | Anirudh Oppiliappan <x@icyphox.sh> | 2022-12-11 21:17:04 +0530 |
commit | ce71721c6dc80db8af63f2098a1548308e2621b2 (patch) | |
tree | 80a4083382113b095de03f9c5d9032591f4ea439 /templates | |
parent | e0f34796a37666058dce61277bc546add707fb2e (diff) | |
download | legit-ce71721c6dc80db8af63f2098a1548308e2621b2.tar.gz legit-ce71721c6dc80db8af63f2098a1548308e2621b2.tar.bz2 legit-ce71721c6dc80db8af63f2098a1548308e2621b2.zip |
routes, templates: tree and log views
Diffstat (limited to '')
-rw-r--r-- | templates/file.html | 2 | ||||
-rw-r--r-- | templates/log.html | 21 | ||||
-rw-r--r-- | templates/repo.html | 38 |
3 files changed, 55 insertions, 6 deletions
diff --git a/templates/file.html b/templates/file.html index 2ccf1c6..ed6073f 100644 --- a/templates/file.html +++ b/templates/file.html @@ -10,7 +10,7 @@ {{ template "nav" . }} <main> <pre> - {{ .content }} +{{ .content }} </pre> </main> </body> diff --git a/templates/log.html b/templates/log.html new file mode 100644 index 0000000..357a5a8 --- /dev/null +++ b/templates/log.html @@ -0,0 +1,21 @@ +{{ define "log" }} +<html> +{{ template "head" . }} + + <header> + <h1>{{ .meta.Title }}</h1> + <h2>{{ .meta.Description }}</h2> + </header> + <body> + {{ template "nav" . }} + <main> + {{ $repo := .name }} + {{ range .commits }} + <p><a href="/{{ $repo }}/commit/{{ .Hash.String }}">{{ slice .Hash.String 0 8 }}<a> + — {{ .Author.Name }}</p> + <p><pre>{{ .Message }}</pre></p> + {{ end }} + </main> + </body> +</html> +{{ end }} diff --git a/templates/repo.html b/templates/repo.html index e388de3..3c99df5 100644 --- a/templates/repo.html +++ b/templates/repo.html @@ -9,13 +9,41 @@ <body> {{ template "nav" . }} <main> + {{ $repo := .name }} + {{ $ref := .ref }} + {{ $parent := .parent }} + + <table> + <tr> + <td></td> + <td><a href="../">..</a> + </tr> {{ range .files }} - {{ if .IsFile }} - <p>{{ .Mode }} {{ .Name }} {{ .Size }} </p> - {{ else }} - <p>d-------- {{ .Name}}/</p> - {{ end }} + {{ if .IsFile }} + <tr> + <td><code>{{ .Mode }}</code></td> + <td> + {{ if $parent }} + <a href="/{{ $repo }}/blob/{{ $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}</a> + {{ else }} + <a href="/{{ $repo }}/blob/{{ $ref }}/{{ .Name }}">{{ .Name }}</a> + {{ end }} + </td> + </tr> + {{ else }} + <tr> + <td><code>{{ .Mode }}</code></td> + <td> + {{ if $parent }} + <a href="/{{ $repo }}/tree/{{ $ref }}/{{ $parent }}/{{ .Name }}">{{ .Name }}/</a> + {{ else }} + <a href="{{ $repo }}/tree/{{ $ref }}/{{ .Name }}">{{ .Name }}/</a> + {{ end }} + </td> + </tr> + {{ end }} {{ end }} + </table> </main> </body> </html> |