From 3c3c383a9d6dec77e93272483699b3aef2c1dd47 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Thu, 13 Mar 2025 20:17:19 +0800 Subject: [PATCH] Partially port templates used by the index page --- global.ha | 11 +++++++++++ templates/_footer.htmpl | 6 ++++++ templates/_head_common.htmpl | 6 ++++-- templates/_header.htmpl | 14 ++++++++++++++ templates/index.htmpl | 46 +++++++++++++++++++++++++++++++++++++++++----- diff --git a/global.ha b/global.ha new file mode 100644 index 0000000000000000000000000000000000000000..11d7886b0a65ae8bbe666e67243a106a30b5eb97 --- /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 0000000000000000000000000000000000000000..94fef153f75871c9b05df362c3a17ae7c8b02a73 --- /dev/null +++ b/templates/_footer.htmpl @@ -0,0 +1,6 @@ +{{ define _tp_footer(handle: io::handle) (void | io::error | nomem) }} +Lindenii Forge +{{ global.version }} +(source, +upstream) +{{ end }} diff --git a/templates/_head_common.htmpl b/templates/_head_common.htmpl index 6fcfea1ae8a39eb5c04cd26e8b4ded3b0236cf19..bc14cb64a55f6c6b2ca75b6e610cccaaf5902c34 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 }} +{{ define _tp_head_common(handle: io::handle) (void | io::error | nomem) }} + + + {{ end }} diff --git a/templates/_header.htmpl b/templates/_header.htmpl new file mode 100644 index 0000000000000000000000000000000000000000..2eb8d19a5049378710827eb7b90f608903d1d570 --- /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) }} +
+ +
+ {{ if user_id_str != "" }} + {{ username }} + {{ else }} + Login + {{ end }} +
+
+{{ end }} diff --git a/templates/index.htmpl b/templates/index.htmpl index 3562c86985329b338cbf9f02c244a15bdc9fea21..e67cc097cc3fb0102f8d4d40933431e51df56dad 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"; -!} -{{ render _tp_head_common(handle, title) }} +{{ render _tp_head_common(handle) }} +Index – {{ global.title }} -

{{ title }}

+{{ render _tp_header(handle, "test", "test") }} +
+ + + + + + + + + + + + +
Groups
NameDescription
+
+ + + + + + + + + + + + + + + + +
+ Info +
SSH public key{{ global.ssh_pubkey }}
SSH fingerprint{{ global.ssh_fp }}
+
+ {{ end }} -- 2.48.1