{{template "repo/header" .}}
- {{$class := ""}} - {{if .Commit.Signature}} - {{$class = (print $class " isSigned")}} - {{if .Verification.Verified}} - {{if eq .Verification.TrustStatus "trusted"}} - {{$class = (print $class " isVerified")}} - {{else if eq .Verification.TrustStatus "untrusted"}} - {{$class = (print $class " isVerifiedUntrusted")}} - {{else}} - {{$class = (print $class " isVerifiedUnmatched")}} - {{end}} - {{else if .Verification.Warning}} - {{$class = (print $class " isWarning")}} - {{end}} - {{end}} -
+

{{ctx.RenderUtils.RenderCommitMessage .Commit.Message ($.Repository.ComposeMetas ctx)}}{{template "repo/commit_statuses" dict "Status" .CommitStatus "Statuses" .CommitStatuses}}

{{if not $.PageIsWiki}} @@ -68,11 +54,13 @@

+ {{/*FIXME: CurrentRefShortName seems not making sense here (old code), + because the "commit page" has no "$.BranchName" info, so only using DefaultBranch should be enough */}} {{template "repo/branch_dropdown" dict "Repository" .Repository "ShowTabBranches" true "CurrentRefType" "branch" - "CurrentRefShortName" (Iif $.BranchName $.Repository.DefaultBranch) + "CurrentRefShortName" (or $.BranchName $.Repository.DefaultBranch) "RefFormActionTemplate" (print "{RepoLink}/_cherrypick/" .CommitID "/{RefShortName}") }}
@@ -140,125 +128,59 @@ {{end}} {{template "repo/commit_load_branches_and_tags" .}}
-
-
- {{if .Author}} - {{ctx.AvatarUtils.Avatar .Author 28 "tw-mr-2"}} - {{if .Author.FullName}} - {{.Author.FullName}} - {{else}} - {{.Commit.Author.Name}} - {{end}} + +
+
+ {{if .Author}} + {{ctx.AvatarUtils.Avatar .Author 20}} + {{if .Author.FullName}} + {{.Author.FullName}} {{else}} - {{ctx.AvatarUtils.AvatarByEmail .Commit.Author.Email .Commit.Author.Email 28 "tw-mr-2"}} - {{.Commit.Author.Name}} + {{.Commit.Author.Name}} {{end}} - {{DateUtils.TimeSince .Commit.Author.When}} - {{if or (ne .Commit.Committer.Name .Commit.Author.Name) (ne .Commit.Committer.Email .Commit.Author.Email)}} - {{ctx.Locale.Tr "repo.diff.committed_by"}} - {{if ne .Verification.CommittingUser.ID 0}} - {{ctx.AvatarUtils.Avatar .Verification.CommittingUser 28 "tw-mx-2"}} - {{.Commit.Committer.Name}} - {{else}} - {{ctx.AvatarUtils.AvatarByEmail .Commit.Committer.Email .Commit.Committer.Name 28 "tw-mr-2"}} - {{.Commit.Committer.Name}} + {{else}} + {{ctx.AvatarUtils.AvatarByEmail .Commit.Author.Email .Commit.Author.Email 20}} + {{.Commit.Author.Name}} + {{end}} +
+ + {{DateUtils.TimeSince .Commit.Author.When}} + +
+ {{if or (ne .Commit.Committer.Name .Commit.Author.Name) (ne .Commit.Committer.Email .Commit.Author.Email)}} + {{ctx.Locale.Tr "repo.diff.committed_by"}} + {{if ne .Verification.CommittingUser.ID 0}} + {{ctx.AvatarUtils.Avatar .Verification.CommittingUser 20}} + {{.Commit.Committer.Name}} + {{else}} + {{ctx.AvatarUtils.AvatarByEmail .Commit.Committer.Email .Commit.Committer.Name 20}} + {{.Commit.Committer.Name}} + {{end}} + {{end}} +
+ + {{if .Verification}} + {{template "repo/commit_sign_badge" dict "CommitSignVerification" .Verification}} + {{end}} + +
+ +
+ {{if .Parents}} +
+ {{ctx.Locale.Tr "repo.diff.parent"}} + {{range .Parents}} + {{ShortSha .}} {{end}} - {{end}} -
-
- {{if .Parents}} -
- {{ctx.Locale.Tr "repo.diff.parent"}} - {{range .Parents}} - {{if $.PageIsWiki}} - {{ShortSha .}} - {{else}} - {{ShortSha .}} - {{end}} - {{end}} -
- {{end}} -
- {{ctx.Locale.Tr "repo.diff.commit"}} - {{ShortSha .CommitID}}
-
-
- {{if .Commit.Signature}} -
-
- {{if .Verification.Verified}} - {{if ne .Verification.SigningUser.ID 0}} - {{svg "gitea-lock" 16 "tw-mr-2"}} - {{if eq .Verification.TrustStatus "trusted"}} - {{ctx.Locale.Tr "repo.commits.signed_by"}}: - {{else if eq .Verification.TrustStatus "untrusted"}} - {{ctx.Locale.Tr "repo.commits.signed_by_untrusted_user"}}: - {{else}} - {{ctx.Locale.Tr "repo.commits.signed_by_untrusted_user_unmatched"}}: - {{end}} - {{ctx.AvatarUtils.Avatar .Verification.SigningUser 28 "tw-mr-2"}} - {{.Verification.SigningUser.GetDisplayName}} - {{else}} - {{svg "gitea-lock-cog" 16 "tw-mr-2"}} - {{ctx.Locale.Tr "repo.commits.signed_by"}}: - {{ctx.AvatarUtils.AvatarByEmail .Verification.SigningEmail "" 28 "tw-mr-2"}} - {{.Verification.SigningUser.GetDisplayName}} - {{end}} - {{else}} - {{svg "gitea-unlock" 16 "tw-mr-2"}} - {{ctx.Locale.Tr .Verification.Reason}} - {{end}} -
-
- {{if .Verification.Verified}} - {{if ne .Verification.SigningUser.ID 0}} - {{svg "octicon-verified" 16 "tw-mr-2"}} - {{if .Verification.SigningSSHKey}} - {{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}: - {{.Verification.SigningSSHKey.Fingerprint}} - {{else}} - {{ctx.Locale.Tr "repo.commits.gpg_key_id"}}: - {{.Verification.SigningKey.PaddedKeyID}} - {{end}} - {{else}} - {{svg "octicon-unverified" 16 "tw-mr-2"}} - {{if .Verification.SigningSSHKey}} - {{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}: - {{.Verification.SigningSSHKey.Fingerprint}} - {{else}} - {{ctx.Locale.Tr "repo.commits.gpg_key_id"}}: - {{.Verification.SigningKey.PaddedKeyID}} - {{end}} - {{end}} - {{else if .Verification.Warning}} - {{svg "octicon-unverified" 16 "tw-mr-2"}} - {{if .Verification.SigningSSHKey}} - {{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}: - {{.Verification.SigningSSHKey.Fingerprint}} - {{else}} - {{ctx.Locale.Tr "repo.commits.gpg_key_id"}}: - {{.Verification.SigningKey.PaddedKeyID}} - {{end}} - {{else}} - {{if .Verification.SigningKey}} - {{if ne .Verification.SigningKey.KeyID ""}} - {{svg "octicon-verified" 16 "tw-mr-2"}} - {{ctx.Locale.Tr "repo.commits.gpg_key_id"}}: - {{.Verification.SigningKey.PaddedKeyID}} - {{end}} - {{end}} - {{if .Verification.SigningSSHKey}} - {{if ne .Verification.SigningSSHKey.Fingerprint ""}} - {{svg "octicon-verified" 16 "tw-mr-2"}} - {{ctx.Locale.Tr "repo.commits.ssh_key_fingerprint"}}: - {{.Verification.SigningSSHKey.Fingerprint}} - {{end}} - {{end}} - {{end}} + {{end}} +
+ {{ctx.Locale.Tr "repo.diff.commit"}} + {{ShortSha .CommitID}}
- {{end}} +
+ {{if .NoteRendered}}
{{svg "octicon-note" 16 "tw-mr-2"}} @@ -274,12 +196,13 @@ {{else}} {{.NoteCommit.Author.Name}} {{end}} - {{DateUtils.TimeSince .NoteCommit.Author.When}} + {{DateUtils.TimeSince .NoteCommit.Author.When}}
{{.NoteRendered | SanitizeHTML}}
{{end}} + {{template "repo/diff/box" .}}
diff --git a/templates/repo/commit_sign_badge.tmpl b/templates/repo/commit_sign_badge.tmpl new file mode 100644 index 0000000000..aa68e9dd23 --- /dev/null +++ b/templates/repo/commit_sign_badge.tmpl @@ -0,0 +1,78 @@ +{{/* Template attributes: +* Commit +* CommitBaseLink +* CommitSignVerification +If you'd like to modify this template, you could test it on the devtest page. +ATTENTION: this template could be re-rendered many times (on the graph and commit list page), +so this template should be kept as small as possbile, DO NOT put large components like modal/dialog into it. +*/}} +{{- $commit := $.Commit -}} +{{- $commitBaseLink := $.CommitBaseLink -}} +{{- $verification := $.CommitSignVerification -}} + +{{- $extraClass := "" -}} +{{- $verified := false -}} +{{- $signingUser := NIL -}} +{{- $signingEmail := "" -}} +{{- $msgReasonPrefix := "" -}} +{{- $msgReason := "" -}} +{{- $msgSigningKey := "" -}} + +{{- if $verification -}} + {{- $signingUser = $verification.SigningUser -}} + {{- $signingEmail = $verification.SigningEmail -}} + {{- $extraClass = print $extraClass " commit-is-signed" -}} + {{- if $verification.Verified -}} + {{- /* reason is "{name} / {key-id}" */ -}} + {{- $msgReason = $verification.Reason -}} + {{- $verified = true -}} + {{- if eq $verification.TrustStatus "trusted" -}} + {{- $extraClass = print $extraClass " sign-trusted" -}} + {{- else if eq $verification.TrustStatus "untrusted" -}} + {{- $extraClass = print $extraClass " sign-untrusted" -}} + {{- $msgReasonPrefix = ctx.Locale.Tr "repo.commits.signed_by_untrusted_user" -}} + {{- else -}} + {{- $extraClass = print $extraClass " sign-unmatched" -}} + {{- $msgReasonPrefix = ctx.Locale.Tr "repo.commits.signed_by_untrusted_user_unmatched" -}} + {{- end -}} + {{- else -}} + {{- if $verification.Warning -}} + {{- $extraClass = print $extraClass " sign-warning" -}} + {{- end -}} + {{- $msgReason = ctx.Locale.Tr $verification.Reason -}}{{- /* dirty part: it is the translation key ..... */ -}} + {{- end -}} + + {{- if $msgReasonPrefix -}} + {{- $msgReason = print $msgReasonPrefix ": " $msgReason -}} + {{- end -}} + + {{- if $verification.SigningSSHKey -}} + {{- $msgSigningKey = print (ctx.Locale.Tr "repo.commits.ssh_key_fingerprint") ": " $verification.SigningSSHKey.Fingerprint -}} + {{- else if $verification.SigningKey -}} + {{- $msgSigningKey = print (ctx.Locale.Tr "repo.commits.gpg_key_id") ": " $verification.SigningKey.PaddedKeyID -}} + {{- end -}} +{{- end -}} + +{{- if $commit -}} + + {{- ShortSha $commit.ID.String -}} +{{- end -}} + + {{- if $verified -}} + {{- if and $signingUser $signingUser.ID -}} + {{svg "gitea-lock"}} + {{ctx.AvatarUtils.Avatar $signingUser 16}} + {{- else -}} + {{svg "gitea-lock-cog"}} + {{ctx.AvatarUtils.AvatarByEmail $signingEmail "" 16}} + {{- end -}} + {{- else -}} + {{svg "gitea-unlock"}} + {{- end -}} + + +{{- if $commit -}} + +{{- end -}} + +{{- /* This template should be kept as small as possbile, DO NOT put large components like modal/dialog into it. */ -}} diff --git a/templates/repo/commit_statuses.tmpl b/templates/repo/commit_statuses.tmpl index f451ac06a1..a6f75584a3 100644 --- a/templates/repo/commit_statuses.tmpl +++ b/templates/repo/commit_statuses.tmpl @@ -1,10 +1,10 @@ {{if .Statuses}} {{if and (eq (len .Statuses) 1) .Status.TargetURL}} - + {{template "repo/commit_status" .Status}} {{else}} - + {{template "repo/commit_status" .Status}} {{end}} diff --git a/templates/repo/commits_list.tmpl b/templates/repo/commits_list.tmpl index 50b754cc23..329dc45149 100644 --- a/templates/repo/commits_list.tmpl +++ b/templates/repo/commits_list.tmpl @@ -28,33 +28,15 @@
- {{$class := "ui sha label"}} - {{if .Signature}} - {{$class = (print $class " isSigned")}} - {{if .Verification.Verified}} - {{if eq .Verification.TrustStatus "trusted"}} - {{$class = (print $class " isVerified")}} - {{else if eq .Verification.TrustStatus "untrusted"}} - {{$class = (print $class " isVerifiedUntrusted")}} - {{else}} - {{$class = (print $class " isVerifiedUnmatched")}} - {{end}} - {{else if .Verification.Warning}} - {{$class = (print $class " isWarning")}} - {{end}} - {{end}} - {{$commitShaLink := ""}} + {{$commitBaseLink := ""}} {{if $.PageIsWiki}} - {{$commitShaLink = (printf "%s/wiki/commit/%s" $commitRepoLink (PathEscape .ID.String))}} + {{$commitBaseLink = printf "%s/wiki/commit" $commitRepoLink}} {{else if $.PageIsPullCommits}} - {{$commitShaLink = (printf "%s/pulls/%d/commits/%s" $commitRepoLink $.Issue.Index (PathEscape .ID.String))}} + {{$commitBaseLink = printf "%s/pulls/%d/commits" $commitRepoLink $.Issue.Index}} {{else if $.Reponame}} - {{$commitShaLink = (printf "%s/commit/%s" $commitRepoLink (PathEscape .ID.String))}} + {{$commitBaseLink = printf "%s/commit" $commitRepoLink}} {{end}} - - {{ShortSha .ID.String}} - {{if .Signature}}{{template "repo/shabox_badge" dict "root" $ "verification" .Verification}}{{end}} - + {{template "repo/commit_sign_badge" dict "Commit" . "CommitBaseLink" $commitBaseLink "CommitSignVerification" .Verification}} diff --git a/templates/repo/commits_list_small.tmpl b/templates/repo/commits_list_small.tmpl index 0657eaba1d..2acf7c58b8 100644 --- a/templates/repo/commits_list_small.tmpl +++ b/templates/repo/commits_list_small.tmpl @@ -3,7 +3,7 @@ {{range .comment.Commits}} {{$tag := printf "%s-%d" $.comment.HashTag $index}} {{$index = Eval $index "+" 1}} -
+
{{/*singular-commit*/}} {{svg "octicon-git-commit"}} {{if .User}} {{ctx.AvatarUtils.Avatar .User 20}} @@ -11,7 +11,8 @@ {{ctx.AvatarUtils.AvatarByEmail .Author.Email .Author.Name 20}} {{end}} - {{$commitLink:= printf "%s/commit/%s" $.comment.Issue.PullRequest.BaseRepo.Link (PathEscape .ID.String)}} + {{$commitBaseLink := printf "%s/commit" $.comment.Issue.PullRequest.BaseRepo.Link}} + {{$commitLink:= printf "%s/%s" $commitBaseLink (PathEscape .ID.String)}} {{- ctx.RenderUtils.RenderCommitMessageLinkSubject .Message $commitLink ($.comment.Issue.PullRequest.BaseRepo.ComposeMetas ctx) -}} @@ -21,29 +22,9 @@ {{end}} - + {{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses}} - {{$class := "ui sha label"}} - {{if .Signature}} - {{$class = (print $class " isSigned")}} - {{if .Verification.Verified}} - {{if eq .Verification.TrustStatus "trusted"}} - {{$class = (print $class " isVerified")}} - {{else if eq .Verification.TrustStatus "untrusted"}} - {{$class = (print $class " isVerifiedUntrusted")}} - {{else}} - {{$class = (print $class " isVerifiedUnmatched")}} - {{end}} - {{else if .Verification.Warning}} - {{$class = (print $class " isWarning")}} - {{end}} - {{end}} - - {{ShortSha .ID.String}} - {{if .Signature}} - {{template "repo/shabox_badge" dict "root" $.root "verification" .Verification}} - {{end}} - + {{template "repo/commit_sign_badge" dict "Commit" . "CommitBaseLink" $commitBaseLink "CommitSignVerification" .Verification}}
{{if IsMultilineCommitMessage .Message}} diff --git a/templates/repo/contributors.tmpl b/templates/repo/contributors.tmpl index 6b8a63fe99..882d8b205c 100644 --- a/templates/repo/contributors.tmpl +++ b/templates/repo/contributors.tmpl @@ -1,6 +1,7 @@ {{if .Permission.CanRead ctx.Consts.RepoUnitTypeCode}}
@@ -6,42 +7,48 @@
{{if or (eq $expandDirection 3) (eq $expandDirection 5)}} - {{end}} {{if or (eq $expandDirection 3) (eq $expandDirection 4)}} - {{end}} {{if eq $expandDirection 2}} - {{end}}
- {{$inlineDiff := $.section.GetComputedInlineDiffFor $line ctx.Locale}}{{/* - */}}{{template "repo/diff/section_code" dict "diff" $inlineDiff}} + + {{- $inlineDiff := $.section.GetComputedInlineDiffFor $line ctx.Locale -}} + {{- template "repo/diff/section_code" dict "diff" $inlineDiff -}} + {{else}} {{$inlineDiff := $.section.GetComputedInlineDiffFor $line ctx.Locale}} {{if and $line.LeftIdx $inlineDiff.EscapeStatus.Escaped}}{{end}} {{if $line.LeftIdx}}{{end}} - {{/* - */}}{{if $line.LeftIdx}}{{template "repo/diff/section_code" dict "diff" $inlineDiff}}{{else}}{{/* - */}}{{/* - */}}{{end}}{{/* - */}} + + {{- if $line.LeftIdx -}} + {{- template "repo/diff/section_code" dict "diff" $inlineDiff -}} + {{- else -}} + + {{- end -}} + {{if and $line.RightIdx $inlineDiff.EscapeStatus.Escaped}}{{end}} {{if $line.RightIdx}}{{end}} - {{/* - */}}{{if $line.RightIdx}}{{template "repo/diff/section_code" dict "diff" $inlineDiff}}{{else}}{{/* - */}}{{/* - */}}{{end}}{{/* - */}} + + {{- if $line.RightIdx -}} + {{- template "repo/diff/section_code" dict "diff" $inlineDiff -}} + {{- else -}} + + {{- end -}} + {{end}} {{end}} @@ -53,17 +60,17 @@
{{if or (eq $expandDirection 3) (eq $expandDirection 5)}} - {{end}} {{if or (eq $expandDirection 3) (eq $expandDirection 4)}} - {{end}} {{if eq $expandDirection 2}} - {{end}} diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 0f1458bfbf..9733e5f980 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -36,10 +36,7 @@ {{template "repo/diff/options_dropdown" .}} {{if .PageIsPullFiles}}
- {{/* - the following will be replaced by vue component - but this avoids any loading artifacts till the vue component is initialized - */}} + {{/* the following will be replaced by vue component, but this avoids any loading artifacts till the vue component is initialized */}} @@ -167,8 +164,8 @@
{{if not (or $file.IsIncomplete $file.IsBin $file.IsSubmodule)}} - - + + {{end}} {{if and (not $file.IsSubmodule) (not $.PageIsWiki)}} {{if $file.IsDeleted}} @@ -238,7 +235,7 @@ {{if and (not $.Repository.IsArchived) (not .DiffNotAvailable)}} {{end}} {{if (not .DiffNotAvailable)}} diff --git a/templates/repo/diff/escape_title.tmpl b/templates/repo/diff/escape_title.tmpl index e70f4021c7..9787ae1d42 100644 --- a/templates/repo/diff/escape_title.tmpl +++ b/templates/repo/diff/escape_title.tmpl @@ -1,2 +1,2 @@ -{{if .diff.EscapeStatus.HasInvisible}}{{ctx.Locale.Tr "repo.invisible_runes_line"}} {{end}}{{/* -*/}}{{if .diff.EscapeStatus.HasAmbiguous}}{{ctx.Locale.Tr "repo.ambiguous_runes_line"}}{{end}} +{{if .diff.EscapeStatus.HasInvisible}}{{ctx.Locale.Tr "repo.invisible_runes_line"}} {{end -}} +{{- if .diff.EscapeStatus.HasAmbiguous}}{{ctx.Locale.Tr "repo.ambiguous_runes_line"}}{{end}} diff --git a/templates/repo/diff/section_split.tmpl b/templates/repo/diff/section_split.tmpl index 37b42bcb37..9953db5eb2 100644 --- a/templates/repo/diff/section_split.tmpl +++ b/templates/repo/diff/section_split.tmpl @@ -1,5 +1,5 @@ {{$file := .file}} -{{$blobExcerptRepoLink := or ctx.RootData.CommitRepoLink ctx.RootData.RepoLink}} +{{$blobExcerptLink := print (or ctx.RootData.CommitRepoLink ctx.RootData.RepoLink) (Iif $.root.PageIsWiki "/wiki" "") "/blob_excerpt/" (PathEscape $.root.AfterCommitID) "?"}} @@ -20,26 +20,24 @@
{{if or (eq $expandDirection 3) (eq $expandDirection 5)}} - {{end}} {{if or (eq $expandDirection 3) (eq $expandDirection 4)}} - {{end}} {{if eq $expandDirection 2}} - {{end}}
{{$inlineDiff := $section.GetComputedInlineDiffFor $line ctx.Locale}} {{if $inlineDiff.EscapeStatus.Escaped}}{{end}} - {{/* - */}}{{template "repo/diff/section_code" dict "diff" $inlineDiff}}{{/* - */}} + {{template "repo/diff/section_code" dict "diff" $inlineDiff}} {{else if and (eq .GetType 3) $hasmatch}}{{/* DEL */}} {{$match := index $section.Lines $line.Match}} {{- $leftDiff := ""}}{{if $line.LeftIdx}}{{$leftDiff = $section.GetComputedInlineDiffFor $line ctx.Locale}}{{end}} @@ -47,65 +45,65 @@ {{if $line.LeftIdx}}{{if $leftDiff.EscapeStatus.Escaped}}{{end}}{{end}} - {{/* - */}}{{if and $.root.SignedUserID $.root.PageIsPullFiles}}{{/* - */}}{{/* - */}}{{end}}{{/* - */}}{{if $line.LeftIdx}}{{/* - */}}{{template "repo/diff/section_code" dict "diff" $leftDiff}}{{/* - */}}{{else}}{{/* - */}}{{/* - */}}{{end}}{{/* - */}} + + {{- if and $.root.SignedUserID $.root.PageIsPullFiles -}} + + {{- end -}} + {{- if $line.LeftIdx -}} + {{- template "repo/diff/section_code" dict "diff" $leftDiff -}} + {{- else -}} + + {{- end -}} + {{if $match.RightIdx}}{{if $rightDiff.EscapeStatus.Escaped}}{{end}}{{end}} {{if $match.RightIdx}}{{end}} - {{/* - */}}{{if and $.root.SignedUserID $.root.PageIsPullFiles}}{{/* - */}}{{/* - */}}{{end}}{{/* - */}}{{if $match.RightIdx}}{{/* - */}}{{template "repo/diff/section_code" dict "diff" $rightDiff}}{{/* - */}}{{else}}{{/* - */}}{{/* - */}}{{end}}{{/* - */}} + + {{- if and $.root.SignedUserID $.root.PageIsPullFiles -}} + + {{- end -}} + {{- if $match.RightIdx -}} + {{- template "repo/diff/section_code" dict "diff" $rightDiff -}} + {{- else -}} + + {{- end -}} + {{else}} {{$inlineDiff := $section.GetComputedInlineDiffFor $line ctx.Locale}} {{if $line.LeftIdx}}{{if $inlineDiff.EscapeStatus.Escaped}}{{end}}{{end}} {{if $line.LeftIdx}}{{end}} - {{/* - */}}{{if and $.root.SignedUserID $.root.PageIsPullFiles (not (eq .GetType 2))}}{{/* - */}}{{/* - */}}{{end}}{{/* - */}}{{if $line.LeftIdx}}{{/* - */}}{{template "repo/diff/section_code" dict "diff" $inlineDiff}}{{/* - */}}{{else}}{{/* - */}}{{/* - */}}{{end}}{{/* - */}} + + {{- if and $.root.SignedUserID $.root.PageIsPullFiles (not (eq .GetType 2)) -}} + + {{- end -}} + {{- if $line.LeftIdx -}} + {{- template "repo/diff/section_code" dict "diff" $inlineDiff -}} + {{- else -}} + + {{- end -}} + {{if $line.RightIdx}}{{if $inlineDiff.EscapeStatus.Escaped}}{{end}}{{end}} {{if $line.RightIdx}}{{end}} - {{/* - */}}{{if and $.root.SignedUserID $.root.PageIsPullFiles (not (eq .GetType 3))}}{{/* - */}}{{/* - */}}{{end}}{{/* - */}}{{if $line.RightIdx}}{{/* - */}}{{template "repo/diff/section_code" dict "diff" $inlineDiff}}{{/* - */}}{{else}}{{/* - */}}{{/* - */}}{{end}}{{/* - */}} + + {{- if and $.root.SignedUserID $.root.PageIsPullFiles (not (eq .GetType 3)) -}} + + {{- end -}} + {{- if $line.RightIdx -}} + {{- template "repo/diff/section_code" dict "diff" $inlineDiff -}} + {{- else -}} + + {{- end -}} + {{end}} {{if and (eq .GetType 3) $hasmatch}} diff --git a/templates/repo/diff/section_unified.tmpl b/templates/repo/diff/section_unified.tmpl index 708b333291..cb612bc27c 100644 --- a/templates/repo/diff/section_unified.tmpl +++ b/templates/repo/diff/section_unified.tmpl @@ -1,5 +1,7 @@ {{$file := .file}} -{{$blobExcerptRepoLink := or ctx.RootData.CommitRepoLink ctx.RootData.RepoLink}} +{{$repoLink := or ctx.RootData.CommitRepoLink ctx.RootData.RepoLink}} +{{$afterCommitID := or $.root.AfterCommitID "no-after-commit-id"}}{{/* this tmpl is also used by the PR Conversation page, so the "AfterCommitID" may not exist */}} +{{$blobExcerptLink := print $repoLink (Iif $.root.PageIsWiki "/wiki" "") "/blob_excerpt/" (PathEscape $afterCommitID) "?"}} @@ -16,17 +18,17 @@
{{if or (eq $expandDirection 3) (eq $expandDirection 5)}} - {{end}} {{if or (eq $expandDirection 3) (eq $expandDirection 4)}} - {{end}} {{if eq $expandDirection 2}} - {{end}} @@ -48,18 +50,16 @@ {{if eq .GetType 4}} - {{/* - */}}{{template "repo/diff/section_code" dict "diff" $inlineDiff}}{{/* - */}} + {{template "repo/diff/section_code" dict "diff" $inlineDiff}} {{else}} - {{/* - */}}{{if and $.root.SignedUserID $.root.PageIsPullFiles}}{{/* - */}}{{/* - */}}{{end}}{{/* - */}}{{template "repo/diff/section_code" dict "diff" $inlineDiff}}{{/* - */}} + + {{- if and $.root.SignedUserID $.root.PageIsPullFiles -}} + + {{- end -}} + {{- template "repo/diff/section_code" dict "diff" $inlineDiff -}} + {{end}} {{if $line.Comments}} diff --git a/templates/repo/empty.tmpl b/templates/repo/empty.tmpl index d3a81bc51d..7170fe3602 100644 --- a/templates/repo/empty.tmpl +++ b/templates/repo/empty.tmpl @@ -37,9 +37,7 @@ {{end}} {{end}} -
- {{template "repo/clone_buttons" .}} -
+ {{template "repo/clone_buttons" .}}
@@ -73,7 +71,6 @@ git push -u origin {{.Repository.DefaultBranch}}