mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-01 13:44:06 +01:00
e24f651c86
So I found this [linter](https://github.com/Riverside-Healthcare/djlint) which features a mode for go templates, so I gave it a try and it did find a number of valid issue, like unbalanced tags etc. It also has a number of bugs, I had to disable/workaround many issues. Given that this linter is written in python, this does add a dependency on `python` >= 3.8 and `poetry` to the development environment to be able to run this linter locally. - `e.g.` prefixes on placeholders are removed because the linter had a false-positive on `placeholder="e.g. cn=Search"` for the `attr=value` syntax and it's not ideal anyways to write `e.g.` into a placeholder because a placeholder is meant to hold a sample value. - In `templates/repo/settings/options.tmpl` I simplified the logic to not conditionally create opening tags without closing tags because this stuff confuses the linter (and possibly the reader as well).
89 lines
3.7 KiB
Handlebars
89 lines
3.7 KiB
Handlebars
<div class="ui attached table segment commit-table">
|
|
<table class="ui very basic striped table unstackable fixed" id="commits-table">
|
|
<thead>
|
|
<tr>
|
|
<th class="three wide">{{.locale.Tr "repo.commits.author"}}</th>
|
|
<th class="two wide sha">SHA1</th>
|
|
<th class="nine wide message">{{.locale.Tr "repo.commits.message"}}</th>
|
|
<th class="two wide right aligned">{{.locale.Tr "repo.commits.date"}}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="commit-list">
|
|
{{$commitRepoLink := $.RepoLink}}{{if $.CommitRepoLink}}{{$commitRepoLink = $.CommitRepoLink}}{{end}}
|
|
{{range .Commits}}
|
|
<tr>
|
|
<td class="author">
|
|
{{$userName := .Author.Name}}
|
|
{{if .User}}
|
|
{{if .User.FullName}}
|
|
{{$userName = .User.FullName}}
|
|
{{end}}
|
|
{{avatar $.Context .User 28 "gt-mr-2"}}<a href="{{.User.HomeLink}}">{{$userName}}</a>
|
|
{{else}}
|
|
{{avatarByEmail $.Context .Author.Email .Author.Name 28 "gt-mr-2"}}
|
|
{{$userName}}
|
|
{{end}}
|
|
</td>
|
|
<td class="sha gt-df">
|
|
<button class="ui button copy-commit-sha gt-df gt-ac" data-clipboard-text="{{.ID}}">{{svg "octicon-copy" 14}}</button>
|
|
{{$class := "ui sha label"}}
|
|
{{if .Signature}}
|
|
{{$class = (printf "%s%s" $class " isSigned")}}
|
|
{{if .Verification.Verified}}
|
|
{{if eq .Verification.TrustStatus "trusted"}}
|
|
{{$class = (printf "%s%s" $class " isVerified")}}
|
|
{{else if eq .Verification.TrustStatus "untrusted"}}
|
|
{{$class = (printf "%s%s" $class " isVerifiedUntrusted")}}
|
|
{{else}}
|
|
{{$class = (printf "%s%s" $class " isVerifiedUnmatched")}}
|
|
{{end}}
|
|
{{else if .Verification.Warning}}
|
|
{{$class = (printf "%s%s" $class " isWarning")}}
|
|
{{end}}
|
|
{{end}}
|
|
{{if $.PageIsWiki}}
|
|
<a href="{{$commitRepoLink}}/wiki/commit/{{.ID}}" rel="nofollow" class="{{$class}}">
|
|
{{else if $.Reponame}}
|
|
<a href="{{$commitRepoLink}}/commit/{{.ID}}" rel="nofollow" class="{{$class}}">
|
|
{{else}}
|
|
<span class="{{$class}}">
|
|
{{end}}
|
|
<span class="shortsha">{{ShortSha .ID.String}}</span>
|
|
{{if .Signature}}
|
|
{{template "repo/shabox_badge" dict "root" $ "verification" .Verification}}
|
|
{{end}}
|
|
{{if $.PageIsWiki}}
|
|
</a>
|
|
{{else if $.Reponame}}
|
|
</a>
|
|
{{else}}
|
|
</span>
|
|
{{end}}
|
|
</td>
|
|
<td class="message">
|
|
<span class="message-wrapper">
|
|
{{if $.PageIsWiki}}
|
|
<span class="commit-summary {{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{.Summary | RenderEmoji $.Context}}</span>
|
|
{{else}}
|
|
{{$commitLink:= printf "%s/commit/%s" $commitRepoLink (PathEscape .ID.String)}}
|
|
<span class="commit-summary {{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{RenderCommitMessageLinkSubject $.Context .Message $commitRepoLink $commitLink $.Repository.ComposeMetas}}</span>
|
|
{{end}}
|
|
</span>
|
|
{{if IsMultilineCommitMessage .Message}}
|
|
<button class="ui button ellipsis-button" aria-expanded="false">...</button>
|
|
{{end}}
|
|
{{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses "root" $}}
|
|
{{if IsMultilineCommitMessage .Message}}
|
|
<pre class="commit-body gt-hidden">{{RenderCommitBody $.Context .Message $commitRepoLink $.Repository.ComposeMetas}}</pre>
|
|
{{end}}
|
|
</td>
|
|
{{if .Committer}}
|
|
<td class="text right aligned">{{TimeSince .Committer.When $.locale}}</td>
|
|
{{else}}
|
|
<td class="text right aligned">{{TimeSince .Author.When $.locale}}</td>
|
|
{{end}}
|
|
</tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
</div>
|