aboutsummaryrefslogtreecommitdiff
path: root/templates/repo_index.tmpl
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-03-07 19:20:54 +0800
committerRunxi Yu <me@runxiyu.org>2025-03-07 19:20:54 +0800
commitb63917094e6a69c8c01f9e7df8716f3d5fc42385 (patch)
treeb959c05bcafefde44a883e1c3896b8c3e4c099c8 /templates/repo_index.tmpl
parentindex, group: Escape path anchors (diff)
downloadforge-b63917094e6a69c8c01f9e7df8716f3d5fc42385.tar.gz
forge-b63917094e6a69c8c01f9e7df8716f3d5fc42385.tar.zst
forge-b63917094e6a69c8c01f9e7df8716f3d5fc42385.zip
repo/index: Display repo info only, when commits/files unavailable
Diffstat (limited to 'templates/repo_index.tmpl')
-rw-r--r--templates/repo_index.tmpl108
1 files changed, 57 insertions, 51 deletions
diff --git a/templates/repo_index.tmpl b/templates/repo_index.tmpl
index 617b8ad..da67df4 100644
--- a/templates/repo_index.tmpl
+++ b/templates/repo_index.tmpl
@@ -41,61 +41,67 @@
<a href="contrib/" class="btn-normal">Merge requests</a>
</p>
</div>
- <div class="padding-wrapper scroll">
- <table id="recent-commits" class="wide">
- <thead>
- <tr class="title-row">
- <th colspan="3">Recent commits (<a href="log/{{ if .ref_type }}?{{ .ref_type }}={{ .ref_name }}{{ end }}">see all</a>)</th>
- </tr>
- <tr>
- <th scope="col">Title</th>
- <th scope="col">Author</th>
- <th scope="col">Author Date</th>
- </tr>
- </thead>
- <tbody>
- {{- range .commits }}
+ {{ if .commits }}
+ <div class="padding-wrapper scroll">
+ <table id="recent-commits" class="wide">
+ <thead>
+ <tr class="title-row">
+ <th colspan="3">Recent commits (<a href="log/{{ if .ref_type }}?{{ .ref_type }}={{ .ref_name }}{{ end }}">see all</a>)</th>
+ </tr>
<tr>
- <td class="commit-title"><a href="commit/{{ .ID }}">{{ .Message | first_line }}</a></td>
- <td class="commit-author">
- <a class="email-name" href="mailto:{{ .Author.Email }}">{{ .Author.Name }}</a>
- </td>
- <td class="commit-time">
- {{ .Author.When.Format "2006-01-02 15:04:05 -0700" }}
- </td>
+ <th scope="col">Title</th>
+ <th scope="col">Author</th>
+ <th scope="col">Author Date</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{- range .commits }}
+ <tr>
+ <td class="commit-title"><a href="commit/{{ .ID }}">{{ .Message | first_line }}</a></td>
+ <td class="commit-author">
+ <a class="email-name" href="mailto:{{ .Author.Email }}">{{ .Author.Name }}</a>
+ </td>
+ <td class="commit-time">
+ {{ .Author.When.Format "2006-01-02 15:04:05 -0700" }}
+ </td>
+ </tr>
+ {{- end }}
+ </tbody>
+ </table>
+ </div>
+ {{ end }}
+ {{ if .files }}
+ <div class="padding-wrapper scroll">
+ <table id="file-tree" class="wide">
+ <thead>
+ <tr class="title-row">
+ <th colspan="3">/{{ if .ref_name }} on {{ .ref_name }}{{ end }}</th>
</tr>
- {{- end }}
- </tbody>
- </table>
- </div>
- <div class="padding-wrapper scroll">
- <table id="file-tree" class="wide">
- <thead>
- <tr class="title-row">
- <th colspan="3">/{{ if .ref_name }} on {{ .ref_name }}{{ end }}</th>
- </tr>
- <tr>
- <th scope="col">Mode</th>
- <th scope="col">Filename</th>
- <th scope="col">Size</th>
- </tr>
- </thead>
- <tbody>
- {{- $ref_type := .ref_type }}
- {{- $ref := .ref_name }}
- {{- range .files }}
<tr>
- <td class="file-mode">{{ .Mode }}</td>
- <td class="file-name"><a href="tree/{{ .Name }}{{ if not .Is_file }}/{{ end }}{{ if $ref_type }}?{{ $ref_type }}={{ $ref }}{{ end }}">{{ .Name }}</a>{{ if not .Is_file }}/{{ end }}</td>
- <td class="file-size">{{ .Size }}</td>
+ <th scope="col">Mode</th>
+ <th scope="col">Filename</th>
+ <th scope="col">Size</th>
</tr>
- {{- end }}
- </tbody>
- </table>
- </div>
- <div class="padding-wrapper" id="readme">
- {{ .readme }}
- </div>
+ </thead>
+ <tbody>
+ {{- $ref_type := .ref_type }}
+ {{- $ref := .ref_name }}
+ {{- range .files }}
+ <tr>
+ <td class="file-mode">{{ .Mode }}</td>
+ <td class="file-name"><a href="tree/{{ .Name }}{{ if not .Is_file }}/{{ end }}{{ if $ref_type }}?{{ $ref_type }}={{ $ref }}{{ end }}">{{ .Name }}</a>{{ if not .Is_file }}/{{ end }}</td>
+ <td class="file-size">{{ .Size }}</td>
+ </tr>
+ {{- end }}
+ </tbody>
+ </table>
+ </div>
+ {{ end }}
+ {{ if .readme }}
+ <div class="padding-wrapper" id="readme">
+ {{ .readme }}
+ </div>
+ {{ end }}
<footer>
{{ template "footer" . }}
</footer>