diff options
-rw-r--r-- | global.ha | 11 | ||||
-rw-r--r-- | templates/_footer.htmpl | 6 | ||||
-rw-r--r-- | templates/_head_common.htmpl | 6 | ||||
-rw-r--r-- | templates/_header.htmpl | 14 | ||||
-rw-r--r-- | templates/index.htmpl | 46 |
5 files changed, 76 insertions, 7 deletions
diff --git a/global.ha b/global.ha new file mode 100644 index 0000000..11d7886 --- /dev/null +++ b/global.ha @@ -0,0 +1,11 @@ +let global: struct { + title: str, + version: str, + ssh_pubkey: str, + ssh_fp: str, +} = struct { + title: str = "Test Forge", + version: str = "v0.0.0", + ssh_pubkey: str = "pubkey", + ssh_fp: str = "fp", +}; diff --git a/templates/_footer.htmpl b/templates/_footer.htmpl new file mode 100644 index 0000000..94fef15 --- /dev/null +++ b/templates/_footer.htmpl @@ -0,0 +1,6 @@ +{{ define _tp_footer(handle: io::handle) (void | io::error | nomem) }} +<a href="https://lindenii.runxiyu.org/forge/">Lindenii Forge</a> +{{ global.version }} +(<a href="/:/source/">source</a>, +<a href="https://forge.lindenii.runxiyu.org/lindenii/forge/:/repos/server/">upstream</a>) +{{ end }} diff --git a/templates/_head_common.htmpl b/templates/_head_common.htmpl index 6fcfea1..bc14cb6 100644 --- a/templates/_head_common.htmpl +++ b/templates/_head_common.htmpl @@ -1,3 +1,5 @@ -{{ define _tp_head_common(handle: io::handle, title: str = "Untitled") (void | io::error | nomem) }} -<title>{{ title }}</title> +{{ define _tp_head_common(handle: io::handle) (void | io::error | nomem) }} +<meta charset="utf-8" /> +<meta name="viewport" content="width=device-width, initial-scale=1" /> +<link rel="stylesheet" href="/:/static/style.css" /> {{ end }} diff --git a/templates/_header.htmpl b/templates/_header.htmpl new file mode 100644 index 0000000..2eb8d19 --- /dev/null +++ b/templates/_header.htmpl @@ -0,0 +1,14 @@ +{{ define _tp_header(handle: io::handle, user_id_str: str, username: str) (void | io::error | nomem) }} +<header id="main-header"> + <div id="main-header-forge-title"> + <a href="/">{{ global.title }}</a> + </div> + <div id="main-header-user"> + {{ if user_id_str != "" }} + <a href="/:/users/{{ user_id_str }}">{{ username }}</a> + {{ else }} + <a href="/:/login/">Login</a> + {{ end }} + </div> +</header> +{{ end }} diff --git a/templates/index.htmpl b/templates/index.htmpl index 3562c86..e67cc09 100644 --- a/templates/index.htmpl +++ b/templates/index.htmpl @@ -1,14 +1,50 @@ {{ define tp_index(handle: io::handle) (void | io::error | nomem) }} -{! - let title: str = "Test"; -!} <!DOCTYPE html> <html lang="en"> <head> -{{ render _tp_head_common(handle, title) }} +{{ render _tp_head_common(handle) }} +<title>Index – {{ global.title }}</title> </head> <body> -<h1>{{ title }}</h1> +{{ render _tp_header(handle, "test", "test") }} +<div class="padding-wrapper"> +<table class="wide rounded"> + <thead> + <tr> + <th colspan="2" class="title-row">Groups</th> + </tr> + <tr> + <th scope="col">Name</th> + <th scope="col">Description</th> + </tr> + </thead> + <tbody> + </tbody> +</table> +<div class="padding-wrapper"> + <table class="wide rounded"> + <thead> + <tr> + <th colspan="2" class="title-row"> + Info + </th> + </tr> + </thead> + <tbody> + <tr> + <th scope="row">SSH public key</th> + <td><code>{{ global.ssh_pubkey }}</code></td> + </tr> + <tr> + <th scope="row">SSH fingerprint</th> + <td><code>{{ global.ssh_fp }}</code></td> + </tr> + </tbody> + </table> +</div> +<footer> + {{ render _tp_footer(handle) }} +</footer> </body> </html> {{ end }} |