aboutsummaryrefslogtreecommitdiff
path: root/forged/templates/repo_commit.tmpl
diff options
context:
space:
mode:
Diffstat (limited to 'forged/templates/repo_commit.tmpl')
-rw-r--r--forged/templates/repo_commit.tmpl117
1 files changed, 117 insertions, 0 deletions
diff --git a/forged/templates/repo_commit.tmpl b/forged/templates/repo_commit.tmpl
new file mode 100644
index 0000000..470bba9
--- /dev/null
+++ b/forged/templates/repo_commit.tmpl
@@ -0,0 +1,117 @@
+{{/*
+ SPDX-License-Identifier: AGPL-3.0-only
+ SPDX-FileCopyrightText: Copyright (c) 2025 Runxi Yu <https://runxiyu.org>
+*/}}
+{{- define "repo_commit" -}}
+{{- $root := . -}}
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ {{- template "head_common" . -}}
+ <title>Commit {{ .commit_id }} &ndash; {{ .repo_name }} &ndash; {{ template "group_path_plain" .group_path }} &ndash; {{ .global.forge_title -}}</title>
+ </head>
+ <body class="repo-commit">
+ {{- template "header" . -}}
+ <div class="repo-header">
+ <h2>{{- .repo_name -}}</h2>
+ <ul class="nav-tabs-standalone">
+ <li class="nav-item">
+ <a class="nav-link" href="../{{- template "ref_query" $root -}}">Summary</a>
+ </li>
+ <li class="nav-item">
+ <a class="nav-link" href="../tree/{{- template "ref_query" $root -}}">Tree</a>
+ </li>
+ <li class="nav-item">
+ <a class="nav-link" href="../log/{{- template "ref_query" $root -}}">Log</a>
+ </li>
+ <li class="nav-item">
+ <a class="nav-link" href="../branches/">Branches</a>
+ </li>
+ <li class="nav-item">
+ <a class="nav-link" href="../tags/">Tags</a>
+ </li>
+ <li class="nav-item">
+ <a class="nav-link" href="../contrib/">Merge requests</a>
+ </li>
+ <li class="nav-item">
+ <a class="nav-link" href="../settings/">Settings</a>
+ </li>
+ </ul>
+ </div>
+ <div class="repo-header-extension">
+ <div class="repo-header-extension-content">
+ {{- .repo_description -}}
+ </div>
+ </div>
+ <div class="padding-wrapper scroll">
+ <div class="key-val-grid-wrapper">
+ <section id="commit-info" class="key-val-grid">
+ <div class="title-row">Commit info</div>
+ <div class="row-label">ID</div>
+ <div class="row-value">{{- .commit_id -}}</div>
+ <div class="row-label">Author</div>
+ <div class="row-value">
+ <span>{{- .commit_object.Author.Name -}}</span> <span>&lt;<a href="mailto:{{- .commit_object.Author.Email -}}">{{- .commit_object.Author.Email -}}</a>&gt;</span>
+ </div>
+ <div class="row-label">Author date</div>
+ <div class="row-value">{{- .commit_object.Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}</div>
+ <div class="row-label">Committer</div>
+ <div class="row-value">
+ <span>{{- .commit_object.Committer.Name -}}</span> <span>&lt;<a href="mailto:{{- .commit_object.Committer.Email -}}">{{- .commit_object.Committer.Email -}}</a>&gt;</span>
+ </div>
+ <div class="row-label">Committer date</div>
+ <div class="row-value">{{- .commit_object.Committer.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" -}}</div>
+ <div class="row-label">Actions</div>
+ <div class="row-value">
+ <a href="{{- .commit_object.Hash -}}.patch">Get patch</a>
+ </div>
+ </section>
+ </div>
+ </div>
+
+ <div class="padding-wrapper scroll" id="this-commit-message">
+ <pre>{{- .commit_object.Message -}}</pre>
+ </div>
+ <div class="padding-wrapper">
+ {{- $parent_commit_hash := .parent_commit_hash -}}
+ {{- $commit_object := .commit_object -}}
+ {{- 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={{- $parent_commit_hash -}}">{{- .From.Path -}}</a> {{ .From.Mode -}}
+ {{- end -}}
+ <br />
+ {{- if eq .To.Path "" -}}
+ +++ /dev/null
+ {{- else -}}
+ +++ b/<a href="../tree/{{- .To.Path -}}?commit={{- $commit_object.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 -}}