diff --git a/routers/repo/commit.go b/routers/repo/commit.go index 10c2f8a1c..11d9fcbe3 100644 --- a/routers/repo/commit.go +++ b/routers/repo/commit.go @@ -168,6 +168,7 @@ func Diff(ctx *middleware.Context) { } } + ctx.Data["Style"] = ctx.Query("style") == "unified"; ctx.Data["Username"] = userName ctx.Data["Reponame"] = repoName ctx.Data["IsImageFile"] = commit.IsImageFile @@ -213,6 +214,7 @@ func CompareDiff(ctx *middleware.Context) { } commits = models.ValidateCommitsWithEmails(commits) + ctx.Data["Style"] = ctx.Query("style") == "unified"; ctx.Data["CommitRepoLink"] = ctx.Repo.RepoLink ctx.Data["Commits"] = commits ctx.Data["CommitCount"] = commits.Len() diff --git a/templates/repo/diff_box.tmpl b/templates/repo/diff_box.tmpl index bfcad4a1b..08afad145 100644 --- a/templates/repo/diff_box.tmpl +++ b/templates/repo/diff_box.tmpl @@ -6,10 +6,8 @@ {{.i18n.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}}
-
- - -
+ + {{ if .Style }}Inline{{else}}Unified{{end}}
@@ -36,10 +34,11 @@ -
- {{ template "repo/diff_box_unified.tmpl" . }} -
-
- {{ template "repo/diff_box_inline.tmpl" . }} -
+ {{if .Style}} + {{ template "repo/diff_box_unified" . }} + {{else}} + {{ template "repo/diff_box_inline" . }} + {{end}} + {{end}}