aboutsummaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-02-19 08:45:09 +0800
committerRunxi Yu <me@runxiyu.org>2025-02-19 08:49:05 +0800
commitded9d435b081ab552d8c5d4e1f655e7b26a8be0a (patch)
tree6c5698994b393d9b10c53550ce379ef8ce403565 /templates
parenthttp: Add blank contrib/%d template (diff)
downloadforge-ded9d435b081ab552d8c5d4e1f655e7b26a8be0a.tar.gz
forge-ded9d435b081ab552d8c5d4e1f655e7b26a8be0a.tar.zst
forge-ded9d435b081ab552d8c5d4e1f655e7b26a8be0a.zip
repo/contrib: Display merge request diffs
Diffstat (limited to '')
-rw-r--r--templates/repo_contrib_num.tmpl18
-rw-r--r--templates/repo_contrib_one.tmpl83
2 files changed, 83 insertions, 18 deletions
diff --git a/templates/repo_contrib_num.tmpl b/templates/repo_contrib_num.tmpl
deleted file mode 100644
index dc34c53..0000000
--- a/templates/repo_contrib_num.tmpl
+++ /dev/null
@@ -1,18 +0,0 @@
-{{- 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 -}}
diff --git a/templates/repo_contrib_one.tmpl b/templates/repo_contrib_one.tmpl
new file mode 100644
index 0000000..85cac10
--- /dev/null
+++ b/templates/repo_contrib_one.tmpl
@@ -0,0 +1,83 @@
+{{- define "repo_contrib_one" -}}
+<!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-one">
+ {{ template "header" . }}
+ <div class="padding-wrapper">
+ <table id="mr-info-table">
+ <thead>
+ <tr class="title-row">
+ <th colspan="2">Merge request info</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <th scope="row">ID</th>
+ <td>{{ .mr_id }}</td>
+ </tr>
+ <tr>
+ <th scope="row">Status</th>
+ <td>{{ .mr_status }}</td>
+ </tr>
+ <tr>
+ <th scope="row">Title</th>
+ <td>{{ .mr_title }}</td>
+ </tr>
+ <tr>
+ <th scope="row">Source ref</th>
+ <td>{{ .mr_source_ref }}</td>
+ </tr>
+ <tr>
+ <th scope="row">Destination branch</th>
+ <td>{{ .mr_destination_branch }}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <div class="padding-wrapper">
+ {{ $destination_commit := .destination_commit }}
+ {{ $source_commit := .source_commit }}
+ {{ range .file_patches }}
+ <div class="file-patch toggle-on-wrapper">
+ <input type="checkbox" id="toggle-{{ .From.Hash }}{{ .To.Hash }}" class="file-toggle toggle-on-toggle">
+ <label for="toggle-{{ .From.Hash }}{{ .To.Hash }}" class="file-header toggle-on-header">
+ <div>
+ {{ if eq .From.Path "" }}
+ --- /dev/null
+ {{ else }}
+ --- a/<a href="../../tree/{{ .From.Path }}?commit={{ $destination_commit.Hash }}">{{ .From.Path }}</a> {{ .From.Mode }}
+ {{ end }}
+ <br />
+ {{ if eq .To.Path "" }}
+ +++ /dev/null
+ {{ else }}
+ +++ b/<a href="../../tree/{{ .To.Path }}?commit={{ $source_commit.Hash }}">{{ .To.Path }}</a> {{ .To.Mode }}
+ {{ end }}
+ </div>
+ </label>
+ <div class="file-content toggle-on-content scroll">
+ {{ range .Chunks }}
+ {{ if eq .Operation 0 }}
+ <pre class="chunk chunk-unchanged">{{ .Content }}</pre>
+ {{ else if eq .Operation 1 }}
+ <pre class="chunk chunk-addition">{{ .Content }}</pre>
+ {{ else if eq .Operation 2 }}
+ <pre class="chunk chunk-deletion">{{ .Content }}</pre>
+ {{ else }}
+ <pre class="chunk chunk-unknown">{{ .Content }}</pre>
+ {{ end }}
+ {{ end }}
+ </div>
+ </div>
+ {{ end }}
+ </div>
+ <footer>
+ {{ template "footer" . }}
+ </footer>
+ </body>
+</html>
+{{- end -}}