aboutsummaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/repo/diff/box.tmpl21
-rw-r--r--templates/repo/diff/stats.tmpl6
2 files changed, 9 insertions, 18 deletions
diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl
index 05f056feb8..d34d9b8fd9 100644
--- a/templates/repo/diff/box.tmpl
+++ b/templates/repo/diff/box.tmpl
@@ -38,12 +38,7 @@
<li>
<div class="diff-counter count pull-right">
{{if not .IsBin}}
- <span class="add" data-line="{{.Addition}}">+{{.Addition}}</span>
- <span class="bar">
- <div class="pull-left add"></div>
- <div class="pull-left del"></div>
- </span>
- <span class="del" data-line="{{.Deletion}}">-{{.Deletion}}</span>
+ {{template "repo/diff/stats" .}}
{{else}}
<span>{{$.i18n.Tr "repo.diff.bin"}}</span>
{{end}}
@@ -60,12 +55,7 @@
<h4 class="ui top attached normal header rounded">
<div class="diff-counter count ui left">
{{if not $file.IsRenamed}}
- <span class="add" data-line="{{.Addition}}">+ {{.Addition}}</span>
- <span class="bar">
- <div class="pull-left add"></div>
- <div class="pull-left del"></div>
- </span>
- <span class="del" data-line="{{.Deletion}}">- {{.Deletion}}</span>
+ {{template "repo/diff/stats" .}}
{{end}}
</div>
<span class="file">{{$file.Name}}</span>
@@ -101,12 +91,7 @@
{{if $file.IsBin}}
{{$.i18n.Tr "repo.diff.bin"}}
{{else if not $file.IsRenamed}}
- <span class="add" data-line="{{.Addition}}">+ {{.Addition}}</span>
- <span class="bar">
- <div class="pull-left add"></div>
- <div class="pull-left del"></div>
- </span>
- <span class="del" data-line="{{.Deletion}}">- {{.Deletion}}</span>
+ {{template "repo/diff/stats" .}}
{{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
new file mode 100644
index 0000000000..7e5d34c3dd
--- /dev/null
+++ b/templates/repo/diff/stats.tmpl
@@ -0,0 +1,6 @@
+<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>
+</span>
+<span class="del" data-line="{{.Deletion}}">- {{.Deletion}}</span>