From 053efe176ee241c87c9e31c4e2bbd999f9f77bf2 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Thu, 13 Feb 2025 09:05:01 +0800 Subject: [PATCH] _header.html: Format the main header --- static/style.css | 19 +++++++++++++++++++ templates/_header.html.tmpl | 22 ++++++++++++---------- templates/group_repos.html.tmpl | 4 +--- templates/index.html.tmpl | 4 +--- templates/repo_commit.html.tmpl | 4 +--- templates/repo_index.html.tmpl | 4 +--- templates/repo_log.html.tmpl | 4 +--- templates/repo_raw_dir.html.tmpl | 4 +--- templates/repo_tree_dir.html.tmpl | 4 +--- templates/repo_tree_file.html.tmpl | 4 +--- diff --git a/static/style.css b/static/style.css index 4ebcdfd6a553ad074a79c63dcd5a7de40085bf0a..043da387ed9bd9151c17b3c8d6341a19869ea276 100644 --- a/static/style.css +++ b/static/style.css @@ -29,6 +29,9 @@ --darker-box-background-color: hsl(0, 0%, 20%); --lighter-box-background-color: hsl(0, 0%, 15%); } } +body { + margin: 0; +} html, code, pre { font-size: 1rem; /* TODO: Not always correct */ } @@ -235,3 +238,19 @@ } a.btn, a.btn-white, a.btn-danger, a.btn-normal, a.btn-primary { text-decoration: none; } +header#main-header { + background-color: var(--lighter-box-background-color); + display: flex; + justify-content: space-between; + align-items: center; + padding: 10px; +} + +header#main-header > div#main-header-forge-title { + flex-grow: 1; /* Allows title to take up remaining space */ +} + +header#main-header > div#main-header-user { + display: flex; + align-items: center; /* Ensures user section is vertically aligned */ +} diff --git a/templates/_header.html.tmpl b/templates/_header.html.tmpl index 7c0e4eaf2b75a3b66beb66582ee741e148134ff6..7aebfbccd8ed5592394aeb49d320b6aba80515c0 100644 --- a/templates/_header.html.tmpl +++ b/templates/_header.html.tmpl @@ -1,12 +1,14 @@ {{- define "header" -}} -
- Lindenii Forge -
-
- {{ if ne .user_id "" }} - {{ .username }} - {{ else }} - Login - {{ end }} -
+
+ +
+ {{ if ne .user_id "" }} + {{ .username }} + {{ else }} + Login + {{ end }} +
+
{{- end -}} diff --git a/templates/group_repos.html.tmpl b/templates/group_repos.html.tmpl index 1050ce45cd0cdfed032f7f4a48e2a1631b9a4563..c9c12fd6f7729e02841cbcf1ec938b8ebeffcc99 100644 --- a/templates/group_repos.html.tmpl +++ b/templates/group_repos.html.tmpl @@ -6,9 +6,7 @@ {{ template "head_common" . }} Repos in {{ .group_name }} – Lindenii Forge -
- {{ template "header" . }} -
+ {{ template "header" . }}

Repos in {{ .group_name }} diff --git a/templates/index.html.tmpl b/templates/index.html.tmpl index a8ef4456acdc5c9112d0ce700d6e336d08ad0016..50cd489741671d925b6e556fbf61fb4fb7589463 100644 --- a/templates/index.html.tmpl +++ b/templates/index.html.tmpl @@ -6,9 +6,7 @@ {{ template "head_common" . }} Index – Lindenii Forge -
- {{ template "header" . }} -
+ {{ template "header" . }}

Lindenii Forge

diff --git a/templates/repo_commit.html.tmpl b/templates/repo_commit.html.tmpl index 6c064fc1336806a09d0dfd26a3a6219664b22808..4965d6e91b3b5fc9ad021586661dfbe9643920b5 100644 --- a/templates/repo_commit.html.tmpl +++ b/templates/repo_commit.html.tmpl @@ -6,9 +6,7 @@ {{ template "head_common" . }} {{ .group_name }}/repos/{{ .repo_name }} – Lindenii Forge -
- {{ template "header" . }} -
+ {{ template "header" . }}
{{ template "repo_header" . }}
diff --git a/templates/repo_index.html.tmpl b/templates/repo_index.html.tmpl index f77e10b4d12c6cd90d5cb32bf6d020a1ef2ad472..d799a225e2595c170708b26303953bde96ac14d7 100644 --- a/templates/repo_index.html.tmpl +++ b/templates/repo_index.html.tmpl @@ -6,9 +6,7 @@ {{ template "head_common" . }} {{ .group_name }}/repos/{{ .repo_name }} – Lindenii Forge -
- {{ template "header" . }} -
+ {{ template "header" . }}
{{ template "repo_header" . }}
diff --git a/templates/repo_log.html.tmpl b/templates/repo_log.html.tmpl index 3cc719eca8b78e0c6927d20e57201ae83ca54d9c..34b7c45bb9768330b023e882174dbf5a911bb797 100644 --- a/templates/repo_log.html.tmpl +++ b/templates/repo_log.html.tmpl @@ -6,9 +6,7 @@ {{ template "head_common" . }} Log of {{ .group_name }}/repos/{{ .repo_name }} – Lindenii Forge -
- {{ template "header" . }} -
+ {{ template "header" . }}
{{ template "repo_header" . }}
diff --git a/templates/repo_raw_dir.html.tmpl b/templates/repo_raw_dir.html.tmpl index a005a3242bffa750f0acc246e407d69cc4ffdb3d..dc7bb9864c76baad92eef7c746a2174d818da8cf 100644 --- a/templates/repo_raw_dir.html.tmpl +++ b/templates/repo_raw_dir.html.tmpl @@ -6,9 +6,7 @@ {{ template "head_common" . }} {{ .group_name }}/repos/{{ .repo_name }}/{{ .path_spec }}{{ if ne .path_spec "" }}/{{ end }} – Lindenii Forge -
- {{ template "header" . }} -
+ {{ template "header" . }}
{{ template "repo_header" . }}
diff --git a/templates/repo_tree_dir.html.tmpl b/templates/repo_tree_dir.html.tmpl index 5d2f63289821bca2693eff9c4a6bb7439d976ff7..73ea4cf6680645a639a5045ea8ab3a3348ee568c 100644 --- a/templates/repo_tree_dir.html.tmpl +++ b/templates/repo_tree_dir.html.tmpl @@ -6,9 +6,7 @@ {{ template "head_common" . }} {{ .group_name }}/repos/{{ .repo_name }}/{{ .path_spec }}{{ if ne .path_spec "" }}/{{ end }} – Lindenii Forge -
- {{ template "header" . }} -
+ {{ template "header" . }}
{{ template "repo_header" . }}
diff --git a/templates/repo_tree_file.html.tmpl b/templates/repo_tree_file.html.tmpl index 7b184e3d84bb5d94e6ff43bbbc1a9a8f1ba513cc..9f705c9c420ff284d5d89e4710d7df9a804a2b61 100644 --- a/templates/repo_tree_file.html.tmpl +++ b/templates/repo_tree_file.html.tmpl @@ -7,9 +7,7 @@ {{ .group_name }}/repos/{{ .repo_name }}/{{ .path_spec }} – Lindenii Forge -
- {{ template "header" . }} -
+ {{ template "header" . }}
{{ template "repo_header" . }}
-- 2.48.1