From d4fc25b735555cb53175dba88df258834ba650fb Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Mon, 31 Mar 2025 09:46:58 +0800 Subject: [PATCH] Proper tabs on repo index --- static/style.css | 72 +++++++++++++++++++++++++++++++++++++++++++++-------- templates/_header.tmpl | 3 ++- templates/repo_commit.tmpl | 32 ++++++++++++++++++++++++++++++++ templates/repo_contrib_index.tmpl | 32 ++++++++++++++++++++++++++++++++ templates/repo_contrib_one.tmpl | 32 ++++++++++++++++++++++++++++++++ templates/repo_index.tmpl | 20 ++++++++++++-------- templates/repo_log.tmpl | 51 +++++++++++++++++++++++++++++++-------------------- templates/repo_raw_dir.tmpl | 15 +++++++++++++-- templates/repo_tree_dir.tmpl | 17 ++++++++++++++--- templates/repo_tree_file.tmpl | 17 ++++++++++++++--- diff --git a/static/style.css b/static/style.css index 0776d40b943fd51d0688f7021f385f6458ec4492..ba85d3f0eb24e51bdb54fc266dce2f9a9ccacd8d 100644 --- a/static/style.css +++ b/static/style.css @@ -2,7 +2,15 @@ /* * SPDX-License-Identifier: AGPL-3.0-only * SPDX-FileContributor: Runxi Yu * SPDX-FileContributor: luk3yx + * SPDX-FileContributor: Drew DeVault + * + * Drew did not directly contribute here but we took significant portions of + * SourceHut's CSS. */ + +* { + box-sizing: border-box; +} /* Base styles and variables */ html { @@ -90,14 +98,8 @@ footer a:link, footer a:visited { color: inherit; } -/* Padding containers */ -.padding-wrapper { - margin: 1rem auto; - max-width: 60rem; - padding: 0 5px; -} .padding { - padding: 0 5px; + padding: 0 1rem; } /* Link styles */ @@ -351,7 +353,8 @@ flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; - padding: 0.625rem 1rem; + padding-top: 1rem; + padding-bottom: 1rem; gap: 0.5rem; } #main-header a, #main-header a:link, main-header a:visited { @@ -501,15 +504,19 @@ display: inline-flex; flex-wrap: nowrap; padding: 0; border-bottom: 0.25rem var(--darker-box-background-color) solid; + width: 100%; + max-width: 100%; + min-width: 100%; } -.nav-tabs-standalone li { +.nav-tabs-standalone > li { align-self: flex-end; +} +.nav-tabs-standalone > li > a { padding: 0 1rem; } -.nav-item.active { - font-weigt: bold; +.nav-item a.active { background-color: var(--darker-box-background-color); } @@ -517,3 +524,46 @@ .nav-item a, .nav-item a:link, .nav-item a:visited { text-decoration: none; color: inherit; } + +.repo-header-extension { + margin-bottom: 1rem; + background-color: var(--darker-box-background-color); +} + +.repo-header > h2 { + display: inline; + margin: 0; + padding-right: 1rem; +} + +.repo-header > .nav-tabs-standalone { + border: none; + margin: 0; + flex-grow: 1; + display: inline-flex; + flex-wrap: nowrap; + padding: 0; +} + +.repo-header { + display: flex; + flex-wrap: nowrap; +} + +.repo-header-extension-content { + padding-top: 0.3rem; + padding-bottom: 0.2rem; +} + +.repo-header, .padding-wrapper, .repo-header-extension-content, #main-header { + padding-left: 1rem; + padding-right: 1rem; + max-width: 60rem; + width: 100%; + margin-left: auto; + margin-right: auto; +} + +.padding-wrapper { + margin-bottom: 1rem; +} diff --git a/templates/_header.tmpl b/templates/_header.tmpl index e0d69e4382eb5013565e84b21927b7f4f85f07aa..3fe483a995cafb6759a1c7f99795180b259c3b91 100644 --- a/templates/_header.tmpl +++ b/templates/_header.tmpl @@ -13,7 +13,8 @@ {{- $url_segments := .url_segments -}} {{- $dir_mode := .dir_mode -}} {{- $ref_type := .ref_type -}} {{- $ref := .ref_name -}} - {{- range $i, $segment := .url_segments -}} + {{- range $i := .separator_index -}} + {{- $segment := index $url_segments $i -}} {{- $path = printf "%s/%s" $path $segment -}} / {{ $segment }} diff --git a/templates/repo_commit.tmpl b/templates/repo_commit.tmpl index 4265f391622c880a298458472a62a1b623491a12..be71211d50571184ded0295466168a428b0e4aa4 100644 --- a/templates/repo_commit.tmpl +++ b/templates/repo_commit.tmpl @@ -3,6 +3,7 @@ SPDX-License-Identifier: AGPL-3.0-only SPDX-FileContributor: Runxi Yu */}} {{- define "repo_commit" -}} +{{- $root := . -}} @@ -11,6 +12,37 @@ Commit {{ .commit_id }} – {{ .repo_name }} – {{ template "group_path_plain" .group_path }} – {{ .global.forge_title -}} {{- template "header" . -}} +
+

{{- .repo_name -}}

+ +
+
+
+ {{- .repo_description -}} +
+
diff --git a/templates/repo_contrib_index.tmpl b/templates/repo_contrib_index.tmpl index 81fdb1a50f9bc92f7240ce5425106b19e36abf72..671e0d33099f8e324b88c1add1b270ba10481f24 100644 --- a/templates/repo_contrib_index.tmpl +++ b/templates/repo_contrib_index.tmpl @@ -3,6 +3,7 @@ SPDX-License-Identifier: AGPL-3.0-only SPDX-FileContributor: Runxi Yu */}} {{- define "repo_contrib_index" -}} +{{- $root := . -}} @@ -11,6 +12,37 @@ Merge requests – {{ .repo_name }} – {{ template "group_path_plain" .group_path }} – {{ .global.forge_title -}} {{- template "header" . -}} +
+

{{- .repo_name -}}

+ +
+
+
+ {{- .repo_description -}} +
+
diff --git a/templates/repo_contrib_one.tmpl b/templates/repo_contrib_one.tmpl index 640855abe5f6401e7ceca8b0340e33e6365c04a0..8e10e9b837512d8b4cf926857263e6aded03807e 100644 --- a/templates/repo_contrib_one.tmpl +++ b/templates/repo_contrib_one.tmpl @@ -3,6 +3,7 @@ SPDX-License-Identifier: AGPL-3.0-only SPDX-FileContributor: Runxi Yu */}} {{- define "repo_contrib_one" -}} +{{- $root := . -}} @@ -11,6 +12,37 @@ Merge requests – {{ .repo_name }} – {{ template "group_path_plain" .group_path }} – {{ .global.forge_title -}} {{- template "header" . -}} +
+

{{- .repo_name -}}

+ +
+
+
+ {{- .repo_description -}} +
+
diff --git a/templates/repo_index.tmpl b/templates/repo_index.tmpl index 6db5b0579bd0829f577d6f8bd900c6d690e8bd6e..d07ebf5c8668ea732753c266d5829dc23af89e25 100644 --- a/templates/repo_index.tmpl +++ b/templates/repo_index.tmpl @@ -12,10 +12,11 @@ {{ .repo_name }} – {{ template "group_path_plain" .group_path }} – {{ .global.forge_title -}} {{- template "header" . -}} -
+
+

{{- .repo_name -}}

+
+
+
+ {{- .repo_description -}} +
@@ -74,11 +83,6 @@ {{- end -}}
-
- {{- if .commits -}}
diff --git a/templates/repo_log.tmpl b/templates/repo_log.tmpl index b8f3563749963612e96b76f46d5a2da3f6610ab6..08dd0edd56dcdc8c0ab7a69e58b1fc515c71c029 100644 --- a/templates/repo_log.tmpl +++ b/templates/repo_log.tmpl @@ -12,26 +12,37 @@ Log – {{ .repo_name }} – {{ template "group_path_plain" .group_path }} – {{ .global.forge_title -}} {{- template "header" . -}} - +
+

{{- .repo_name -}}

+ +
+
+
+ {{- .repo_description -}} +
+
diff --git a/templates/repo_raw_dir.tmpl b/templates/repo_raw_dir.tmpl index 1b9f59b52633fcb122b7dcc52be780f74351acd8..927101b183519990fc705ee318be3b4f4ad4831a 100644 --- a/templates/repo_raw_dir.tmpl +++ b/templates/repo_raw_dir.tmpl @@ -12,13 +12,14 @@ /{{ .path_spec }}{{ if ne .path_spec "" }}/{{ end }} – {{ .repo_name }} – {{ template "group_path_plain" .group_path }} – {{ .global.forge_title -}} {{- template "header" . -}} -
+
+

{{- .repo_name -}}

+
+
+
+ {{- .repo_description -}} +
+
+
diff --git a/templates/repo_tree_dir.tmpl b/templates/repo_tree_dir.tmpl index cf942039c4aa3f28ee66efc16472ee6662142051..bc7279a232302332e93a664861485504b02a83a9 100644 --- a/templates/repo_tree_dir.tmpl +++ b/templates/repo_tree_dir.tmpl @@ -12,13 +12,14 @@ /{{ .path_spec }}{{ if ne .path_spec "" }}/{{ end }} – {{ .repo_name }} – {{ template "group_path_plain" .group_path }} – {{ .global.forge_title -}} {{- template "header" . -}} -
+
+

{{- .repo_name -}}

+
+
+
+ {{- .repo_description -}} +
+
+
diff --git a/templates/repo_tree_file.tmpl b/templates/repo_tree_file.tmpl index aa1c020027caa274d4b2644e78d9a753a1228550..56159aaa123faf6b5f89b01133fd0e9597c33f8d 100644 --- a/templates/repo_tree_file.tmpl +++ b/templates/repo_tree_file.tmpl @@ -13,13 +13,14 @@ /{{ .path_spec }} – {{ .repo_name }} – {{ template "group_path_plain" .group_path }} – {{ .global.forge_title -}} {{- template "header" . -}} -
+
+

{{- .repo_name -}}

+
+
+
+ {{- .repo_description -}} +
+
+

/{{ .path_spec }} (raw)

-- 2.48.1