aboutsummaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2020-12-12 02:06:22 +0100
committerGitHub <noreply@github.com>2020-12-12 02:06:22 +0100
commit1837e647eb2ae3f4de0ed1a729f0da01c07b9449 (patch)
tree8abfaacd2a4bda51e09a5633b75864a06772f83c /templates
parent3285babcae57b410815d4415db9c9ea6c6f9a84e (diff)
downloadgitea-1837e647eb2ae3f4de0ed1a729f0da01c07b9449.tar.gz
gitea-1837e647eb2ae3f4de0ed1a729f0da01c07b9449.zip
Diff stat improvements (#13954)
* Diff stat improvements - Combine number to just total number of changes - Add tooltip over stats bar - Increase contrast on file name - Refactor classes and CSS to be more reusable * misc tweaks * make count bold
Diffstat (limited to 'templates')
-rw-r--r--templates/repo/diff/box.tmpl12
-rw-r--r--templates/repo/diff/stats.tmpl8
2 files changed, 9 insertions, 11 deletions
diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl
index 275dc51501..40e9d277b3 100644
--- a/templates/repo/diff/box.tmpl
+++ b/templates/repo/diff/box.tmpl
@@ -36,9 +36,9 @@
<ol class="diff-detail-box diff-stats detail-files hide" id="diff-files">
{{range .Diff.Files}}
<li>
- <div class="diff-counter count pull-right">
+ <div class="diff-counter pull-right">
{{if not .IsBin}}
- {{template "repo/diff/stats" .}}
+ {{template "repo/diff/stats" dict "file" . "root" $}}
{{else}}
<span>{{$.i18n.Tr "repo.diff.bin"}}</span>
{{end}}
@@ -53,9 +53,9 @@
{{if $file.IsIncomplete}}
<div class="diff-file-box diff-box file-content">
<h4 class="ui top attached normal header rounded">
- <div class="diff-counter count ui left">
+ <div class="diff-counter ui left">
{{if not $file.IsRenamed}}
- {{template "repo/diff/stats" .}}
+ {{template "repo/diff/stats" dict "file" . "root" $}}
{{end}}
</div>
<span class="file">{{$file.Name}}</span>
@@ -87,11 +87,11 @@
{{svg "octicon-chevron-down" 18}}
</a>
{{end}}
- <div class="diff-counter count">
+ <div class="diff-counter">
{{if $file.IsBin}}
{{$.i18n.Tr "repo.diff.bin"}}
{{else if not $file.IsRenamed}}
- {{template "repo/diff/stats" .}}
+ {{template "repo/diff/stats" dict "file" . "root" $}}
{{end}}
</div>
<span class="file">{{if $file.IsRenamed}}{{$file.OldName}} &rarr; {{end}}{{$file.Name}}{{if .IsLFSFile}} ({{$.i18n.Tr "repo.stored_lfs"}}){{end}}</span>
diff --git a/templates/repo/diff/stats.tmpl b/templates/repo/diff/stats.tmpl
index 7e5d34c3dd..97503f0ea5 100644
--- a/templates/repo/diff/stats.tmpl
+++ b/templates/repo/diff/stats.tmpl
@@ -1,6 +1,4 @@
-<span class="add" data-line="{{.Addition}}">+ {{.Addition}}</span>
-<span class="bar">
- <div class="pull-left add" style="width: {{DiffStatsWidth .Addition .Deletion}}%"></div>
- <div class="pull-left del"></div>
+{{Add .file.Addition .file.Deletion}}
+<span class="diff-stats-bar poping up ml-2" data-content="{{.root.i18n.Tr "repo.diff.stats_desc_file" (Add .file.Addition .file.Deletion) .file.Addition .file.Deletion | Str2html}}" data-variation="wide">
+ <div class="diff-stats-add-bar" style="width: {{DiffStatsWidth .file.Addition .file.Deletion}}%"></div>
</span>
-<span class="del" data-line="{{.Deletion}}">- {{.Deletion}}</span>