Skip to content

Commit

Permalink
Hide diff stats on empty PRs (go-gitea#30629)
Browse files Browse the repository at this point in the history
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">
  • Loading branch information
silverwind authored and GiteaBot committed Apr 22, 2024
1 parent 4aba4f8 commit 14d7d8f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions templates/repo/pulls/tab_menu.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
{{ctx.Locale.Tr "repo.pulls.tab_files"}}
<span class="ui small label">{{if .NumFiles}}{{.NumFiles}}{{else}}-{{end}}</span>
</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><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">
<div class="diff-stats-add-bar" style="width: {{Eval 100 "*" .Diff.TotalAddition "/" "(" .Diff.TotalAddition "+" .Diff.TotalDeletion "+" 0.0 ")"}}%"></div>
</span>
</span>
{{end}}
</div>
<div class="ui tabs divider"></div>
</div>

0 comments on commit 14d7d8f

Please sign in to comment.