From 053efe176ee241c87c9e31c4e2bbd999f9f77bf2 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Thu, 13 Feb 2025 09:05:01 +0800 Subject: _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 +--- 10 files changed, 39 insertions(+), 34 deletions(-) diff --git a/static/style.css b/static/style.css index 4ebcdfd..043da38 100644 --- a/static/style.css +++ b/static/style.css @@ -29,6 +29,9 @@ html { --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 @@ input[type=file]::file-selector-button { 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 7c0e4ea..7aebfbc 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 1050ce4..c9c12fd 100644 --- a/templates/group_repos.html.tmpl +++ b/templates/group_repos.html.tmpl @@ -6,9 +6,7 @@ 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 a8ef445..50cd489 100644 --- a/templates/index.html.tmpl +++ b/templates/index.html.tmpl @@ -6,9 +6,7 @@ Index – Lindenii Forge -
- {{ template "header" . }} -
+ {{ template "header" . }}

Lindenii Forge

diff --git a/templates/repo_commit.html.tmpl b/templates/repo_commit.html.tmpl index 6c064fc..4965d6e 100644 --- a/templates/repo_commit.html.tmpl +++ b/templates/repo_commit.html.tmpl @@ -6,9 +6,7 @@ {{ .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 f77e10b..d799a22 100644 --- a/templates/repo_index.html.tmpl +++ b/templates/repo_index.html.tmpl @@ -6,9 +6,7 @@ {{ .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 3cc719e..34b7c45 100644 --- a/templates/repo_log.html.tmpl +++ b/templates/repo_log.html.tmpl @@ -6,9 +6,7 @@ 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 a005a32..dc7bb98 100644 --- a/templates/repo_raw_dir.html.tmpl +++ b/templates/repo_raw_dir.html.tmpl @@ -6,9 +6,7 @@ {{ .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 5d2f632..73ea4cf 100644 --- a/templates/repo_tree_dir.html.tmpl +++ b/templates/repo_tree_dir.html.tmpl @@ -6,9 +6,7 @@ {{ .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 7b184e3..9f705c9 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" . }}
-- cgit v1.2.3