diff --git a/templates/repo/diff_box.tmpl b/templates/repo/diff_box.tmpl index 63c57a19d1..a524940f94 100644 --- a/templates/repo/diff_box.tmpl +++ b/templates/repo/diff_box.tmpl @@ -33,9 +33,124 @@ + {{range $i, $file := .Diff.Files}} +
+

+
+ {{if $file.IsBin}} + {{$.i18n.Tr "repo.diff.bin"}} + {{else if not $file.IsRenamed}} + + {{.Addition}} + + + + + - {{.Deletion}} + {{end}} +
+ {{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}} +
+ {{if $file.IsDeleted}} + {{$.i18n.Tr "repo.diff.view_file"}} + {{else}} + {{$.i18n.Tr "repo.diff.view_file"}} + {{end}} +
+

+
+ {{if not $file.IsRenamed}} + {{$isImage := (call $.IsImageFile $file.Name)}} + {{if and $isImage}} +
+ +
+ {{else}} +
+ + + {{if $.IsSplitStyle}} + {{range $j, $section := .Sections}} + {{range $k, $line := .Lines}} + + {{if eq .Type 4}} + + + + + {{else}} + + + + + {{end}} + + {{end}} + {{end}} + {{else}} + {{range $j, $section := .Sections}} + {{range $k, $line := .Lines}} + + {{if eq .Type 4}} + + {{else}} + + + {{end}} + + + {{end}} + {{end}} + {{end}} + +
+ + +
{{$line.Content}}
+
+ + +
{{$line.Content}}
+
+ {{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}} + +
{{if $line.LeftIdx}}{{$line.Content}}{{end}}
+
+ {{if $line.RightIdx}}{{$line.RightIdx}}{{end}} + +
{{if $line.RightIdx}}{{$line.Content}}{{end}}
+
+ {{if gt $j 0}}{{end}} + + {{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}} + + {{if $line.RightIdx}}{{$line.RightIdx}}{{end}} + +
{{$line.Content}}
+
+
+ {{end}} + {{end}} +
+
+
+ {{end}} {{if .IsSplitStyle}} - {{ template "repo/diff_box_split" . }} - {{else}} - {{ template "repo/diff_box_unified" . }} + {{end}} {{end}} diff --git a/templates/repo/diff_box_split.tmpl b/templates/repo/diff_box_split.tmpl deleted file mode 100644 index 4187a7e72a..0000000000 --- a/templates/repo/diff_box_split.tmpl +++ /dev/null @@ -1,94 +0,0 @@ -{{range $i, $file := .Diff.Files}} -
-

-
- {{if $file.IsBin}} - {{$.i18n.Tr "repo.diff.bin"}} - {{else if not $file.IsRenamed}} - + {{.Addition}} - - - - - - {{.Deletion}} - {{end}} -
- {{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}} -
- {{if $file.IsDeleted}} - {{$.i18n.Tr "repo.diff.view_file"}} - {{else}} - {{$.i18n.Tr "repo.diff.view_file"}} - {{end}} -
-

-
- {{if not $file.IsRenamed}} - {{$isImage := (call $.IsImageFile $file.Name)}} - {{if and $isImage}} -
- -
- {{else}} -
- - - {{range $j, $section := .Sections}} - {{range $k, $line := .Lines}} - - {{if eq .Type 4}} - - - - - {{else}} - - - - - {{end}} - - {{end}} - {{end}} - -
- - -
{{$line.Content}}
-
- - -
{{$line.Content}}
-
- {{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}} - -
{{if $line.LeftIdx}}{{$line.Content}}{{end}}
-
- {{if $line.RightIdx}}{{$line.RightIdx}}{{end}} - -
{{if $line.RightIdx}}{{$line.Content}}{{end}}
-
-
- - {{end}} - {{end}} -
-
-
-{{end}} diff --git a/templates/repo/diff_box_unified.tmpl b/templates/repo/diff_box_unified.tmpl deleted file mode 100644 index 82c6ff8d66..0000000000 --- a/templates/repo/diff_box_unified.tmpl +++ /dev/null @@ -1,65 +0,0 @@ -{{range $i, $file := .Diff.Files}} -
-

-
- {{if $file.IsBin}} - {{$.i18n.Tr "repo.diff.bin"}} - {{else if not $file.IsRenamed}} - + {{.Addition}} - - - - - - {{.Deletion}} - {{end}} -
- {{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}} -
- {{if $file.IsDeleted}} - {{$.i18n.Tr "repo.diff.view_file"}} - {{else}} - {{$.i18n.Tr "repo.diff.view_file"}} - {{end}} -
-

-
- {{if not $file.IsRenamed}} - {{$isImage := (call $.IsImageFile $file.Name)}} - {{if and $isImage}} -
- -
- {{else}} -
- - - {{range $j, $section := .Sections}} - {{range $k, $line := .Lines}} - - {{if eq .Type 4}} - - {{else}} - - - {{end}} - - - {{end}} - {{end}} - -
- {{if gt $j 0}}{{end}} - - {{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}} - - {{if $line.RightIdx}}{{$line.RightIdx}}{{end}} - -
{{$line.Content}}
-
-
- {{end}} - {{end}} -
-
-
-{{end}}