aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--http_handle_repo_contrib_num.go9
-rw-r--r--http_server.go10
-rw-r--r--templates/repo_contrib_num.tmpl18
3 files changed, 36 insertions, 1 deletions
diff --git a/http_handle_repo_contrib_num.go b/http_handle_repo_contrib_num.go
new file mode 100644
index 0000000..c4ed5d1
--- /dev/null
+++ b/http_handle_repo_contrib_num.go
@@ -0,0 +1,9 @@
+package main
+
+import (
+ "net/http"
+)
+
+func handle_repo_contrib_num(w http.ResponseWriter, r *http.Request, params map[string]any) {
+ render_template(w, "repo_contrib_num", params)
+}
diff --git a/http_server.go b/http_server.go
index 2bd345c..b44add3 100644
--- a/http_server.go
+++ b/http_server.go
@@ -45,6 +45,7 @@ func (router *http_router_t) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
params := make(map[string]any)
+ params["url_segments"] = segments
params["global"] = global_data
var _user_id int // 0 for none
_user_id, params["username"], err = get_user_info_from_request(r)
@@ -193,7 +194,14 @@ func (router *http_router_t) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if redirect_with_slash(w, r) {
return
}
- handle_repo_contrib_index(w, r, params)
+ switch non_empty_last_segments_len {
+ case separator_index+4:
+ handle_repo_contrib_index(w, r, params)
+ case separator_index+5:
+ handle_repo_contrib_num(w, r, params)
+ default:
+ http.Error(w, "Too many parameters", http.StatusBadRequest)
+ }
default:
http.Error(w, fmt.Sprintf("Unknown repo feature: %s", repo_feature), http.StatusNotFound)
}
diff --git a/templates/repo_contrib_num.tmpl b/templates/repo_contrib_num.tmpl
new file mode 100644
index 0000000..dc34c53
--- /dev/null
+++ b/templates/repo_contrib_num.tmpl
@@ -0,0 +1,18 @@
+{{- define "repo_contrib_num" -}}
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ {{ template "head_common" . }}
+ <title>Merge requests &ndash; {{ .repo_name }} &ndash; {{ .group_name }} &ndash; {{ .global.forge_title }}</title>
+ </head>
+ <body class="repo-contrib-num">
+ {{ template "header" . }}
+ <div class="padding-wrapper">
+ Test
+ </div>
+ <footer>
+ {{ template "footer" . }}
+ </footer>
+ </body>
+</html>
+{{- end -}}