From 3870a7a3c86085477a46ec0663bd875bdb7dba5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20=22BKC=22=20Carlb=C3=A4cker?= Date: Wed, 6 Jan 2016 00:08:50 +0100 Subject: [PATCH] merged split/unified templates --- templates/repo/diff_box.tmpl | 121 ++++++++++++++++++++++++++- templates/repo/diff_box_split.tmpl | 94 --------------------- templates/repo/diff_box_unified.tmpl | 65 -------------- 3 files changed, 118 insertions(+), 162 deletions(-) delete mode 100644 templates/repo/diff_box_split.tmpl delete mode 100644 templates/repo/diff_box_unified.tmpl diff --git a/templates/repo/diff_box.tmpl b/templates/repo/diff_box.tmpl index 63c57a19..a524940f 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 4187a7e7..00000000 --- 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 82c6ff8d..00000000 --- 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}}