Hide diff stats on empty PRs (#30629)
When a PR is empty, e.g. has neither additions nor deletions, we don't need to show this: <img width="125" alt="Screenshot 2024-04-21 at 23 25 38" src="https://github.com/go-gitea/gitea/assets/115237/0b987eb5-66f5-4b9b-b5aa-7e9e267e9b52"> (cherry picked from commit 0386a42f70d1026c50697b12378f5026a63182b9)
This commit is contained in:
parent
2b45aa42f5
commit
02316e1e40
1 changed files with 2 additions and 0 deletions
|
@ -15,12 +15,14 @@
|
||||||
{{ctx.Locale.Tr "repo.pulls.tab_files"}}
|
{{ctx.Locale.Tr "repo.pulls.tab_files"}}
|
||||||
<span class="ui small label">{{if .NumFiles}}{{.NumFiles}}{{else}}-{{end}}</span>
|
<span class="ui small label">{{if .NumFiles}}{{.NumFiles}}{{else}}-{{end}}</span>
|
||||||
</a>
|
</a>
|
||||||
|
{{if or .Diff.TotalAddition .Diff.TotalDeletion}}
|
||||||
<span class="item tw-ml-auto tw-pr-0 tw-font-bold tw-flex tw-items-center tw-gap-2">
|
<span class="item tw-ml-auto tw-pr-0 tw-font-bold tw-flex tw-items-center tw-gap-2">
|
||||||
<span><span class="text green">{{if .Diff.TotalAddition}}+{{.Diff.TotalAddition}}{{end}}</span> <span class="text red">{{if .Diff.TotalDeletion}}-{{.Diff.TotalDeletion}}{{end}}</span></span>
|
<span><span class="text green">{{if .Diff.TotalAddition}}+{{.Diff.TotalAddition}}{{end}}</span> <span class="text red">{{if .Diff.TotalDeletion}}-{{.Diff.TotalDeletion}}{{end}}</span></span>
|
||||||
<span class="diff-stats-bar">
|
<span class="diff-stats-bar">
|
||||||
<div class="diff-stats-add-bar" style="width: {{Eval 100 "*" .Diff.TotalAddition "/" "(" .Diff.TotalAddition "+" .Diff.TotalDeletion "+" 0.0 ")"}}%"></div>
|
<div class="diff-stats-add-bar" style="width: {{Eval 100 "*" .Diff.TotalAddition "/" "(" .Diff.TotalAddition "+" .Diff.TotalDeletion "+" 0.0 ")"}}%"></div>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
<div class="ui tabs divider"></div>
|
<div class="ui tabs divider"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue