From d0cf88cfc3d2c328f9e398ba94a770141f3a7be4 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Mon, 10 Feb 2025 20:01:09 +0800 Subject: category_index -> category_repos --- handle_category_index.go | 4 ++-- main.go | 2 +- templates/category_index.html | 23 ----------------------- templates/category_repos.html | 23 +++++++++++++++++++++++ templates/index.html | 2 +- 5 files changed, 27 insertions(+), 27 deletions(-) delete mode 100644 templates/category_index.html create mode 100644 templates/category_repos.html diff --git a/handle_category_index.go b/handle_category_index.go index d81899a..f9b201c 100644 --- a/handle_category_index.go +++ b/handle_category_index.go @@ -7,7 +7,7 @@ import ( "strings" ) -func handle_category_index(w http.ResponseWriter, r *http.Request) { +func handle_category_repos(w http.ResponseWriter, r *http.Request) { data := make(map[string]any) category_name := r.PathValue("category_name") data["category_name"] = category_name @@ -26,7 +26,7 @@ func handle_category_index(w http.ResponseWriter, r *http.Request) { } data["repos"] = repos - err = templates.ExecuteTemplate(w, "category_index", data) + err = templates.ExecuteTemplate(w, "category_repos", data) if err != nil { _, _ = w.Write([]byte("Error rendering template: " + err.Error())) return diff --git a/main.go b/main.go index 18733c4..81657cd 100644 --- a/main.go +++ b/main.go @@ -32,7 +32,7 @@ func main() { } http.HandleFunc("/{$}", handle_index) - http.HandleFunc("/{category_name}/{$}", handle_category_index) + http.HandleFunc("/{category_name}/repos/{$}", handle_category_repos) http.HandleFunc("/{category_name}/repos/{repo_name}/{$}", handle_repo_index) http.HandleFunc("/{category_name}/repos/{repo_name}/tree/{ref}/{rest...}", handle_repo_tree) diff --git a/templates/category_index.html b/templates/category_index.html deleted file mode 100644 index 7f206a4..0000000 --- a/templates/category_index.html +++ /dev/null @@ -1,23 +0,0 @@ -{{- define "category_index" -}} - - - - {{ template "head_common" . }} - {{ .category_name }} – Lindenii Forge - - -
-

- Repos in {{ .category_name }} -

- -
- - -{{- end -}} diff --git a/templates/category_repos.html b/templates/category_repos.html new file mode 100644 index 0000000..406fee4 --- /dev/null +++ b/templates/category_repos.html @@ -0,0 +1,23 @@ +{{- define "category_repos" -}} + + + + {{ template "head_common" . }} + Repos in {{ .category_name }} – Lindenii Forge + + +
+

+ Repos in {{ .category_name }} +

+ +
+ + +{{- end -}} diff --git a/templates/index.html b/templates/index.html index 7ced768..139abb0 100644 --- a/templates/index.html +++ b/templates/index.html @@ -13,7 +13,7 @@ -- cgit v1.2.3