From dd136858f1ea40ad3c94191d647487fa4f31926c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 18 Oct 2024 20:33:49 +0200 Subject: Adding upstream version 9.0.0. Signed-off-by: Daniel Baumann --- templates/repo/diff/box.tmpl | 260 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 260 insertions(+) create mode 100644 templates/repo/diff/box.tmpl (limited to 'templates/repo/diff/box.tmpl') diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl new file mode 100644 index 0000000..230e497 --- /dev/null +++ b/templates/repo/diff/box.tmpl @@ -0,0 +1,260 @@ +{{$showFileTree := (and (not .DiffNotAvailable) (gt .Diff.NumFiles 1))}} +
+
+
+ {{if $showFileTree}} + + + {{end}} + {{if not .DiffNotAvailable}} +
+ {{svg "octicon-diff" 16 "tw-mr-1"}}{{ctx.Locale.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion}} +
+ {{end}} +
+
+ {{if and .PageIsPullFiles $.SignedUserID (not .IsArchived) (not .DiffNotAvailable)}} +
+ + +
+ {{end}} + {{template "repo/diff/whitespace_dropdown" .}} + {{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 + */}} + +
+ {{end}} + {{if and .PageIsPullFiles $.SignedUserID (not .IsArchived)}} + {{template "repo/diff/new_review" .}} + {{end}} +
+
+ {{if not .DiffNotAvailable}} + {{if and .IsShowingOnlySingleCommit .PageIsPullFiles}} +
+
{{ctx.Locale.Tr "repo.pulls.showing_only_single_commit" (ShortSha .AfterCommitID)}} - {{ctx.Locale.Tr "repo.pulls.show_all_commits"}}
+
+ {{else if and (not .IsShowingAllCommits) .PageIsPullFiles}} +
+
{{ctx.Locale.Tr "repo.pulls.showing_specified_commit_range" (ShortSha .BeforeCommitID) (ShortSha .AfterCommitID)}} - {{ctx.Locale.Tr "repo.pulls.show_all_commits"}}
+
+ {{end}} + +
+ {{end}} +
+ {{if $showFileTree}} +
+ + {{end}} + {{if .DiffNotAvailable}} +

{{ctx.Locale.Tr "repo.diff.data_not_available"}}

+ {{else}} +
+ {{range $i, $file := .Diff.Files}} + {{/*notice: the index of Diff.Files should not be used for element ID, because the index will be restarted from 0 when doing load-more for PRs with a lot of files*/}} + {{$blobBase := call $.GetBlobByPathForCommit $.BeforeCommit $file.OldName}} + {{$blobHead := call $.GetBlobByPathForCommit $.HeadCommit $file.Name}} + {{$sniffedTypeBase := call $.GetSniffedTypeForBlob $blobBase}} + {{$sniffedTypeHead := call $.GetSniffedTypeForBlob $blobHead}} + {{$isImage:= or (call $.IsSniffedTypeAnImage $sniffedTypeBase) (call $.IsSniffedTypeAnImage $sniffedTypeHead)}} + {{$isCsv := (call $.IsCsvFile $file)}} + {{$showFileViewToggle := or $isImage (and (not $file.IsIncomplete) $isCsv)}} + {{$isExpandable := or (gt $file.Addition 0) (gt $file.Deletion 0) $file.IsBin}} + {{$isReviewFile := and $.IsSigned $.PageIsPullFiles (not $.IsArchived) $.IsShowingAllCommits}} +
+

+
+ +
+ {{if $file.IsBin}} + + {{ctx.Locale.Tr "repo.diff.bin"}} + + {{else}} + {{template "repo/diff/stats" dict "file" . "root" $}} + {{end}} +
+ {{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}} + {{if .IsLFSFile}} ({{ctx.Locale.Tr "repo.stored_lfs"}}){{end}} + + {{if $file.IsGenerated}} + {{ctx.Locale.Tr "repo.diff.generated"}} + {{end}} + {{if $file.IsVendored}} + {{ctx.Locale.Tr "repo.diff.vendored"}} + {{end}} + {{if and $file.Mode $file.OldMode}} + {{$old := ctx.Locale.Tr ($file.ModeTranslationKey $file.OldMode)}} + {{$new := ctx.Locale.Tr ($file.ModeTranslationKey $file.Mode)}} + {{ctx.Locale.Tr "git.filemode.changed_filemode" $old $new}} + {{else if $file.Mode}} + {{ctx.Locale.Tr ($file.ModeTranslationKey $file.Mode)}} + {{end}} + +
+
+ {{if $showFileViewToggle}} +
+ + +
+ {{end}} + {{if $file.IsProtected}} + {{ctx.Locale.Tr "repo.diff.protected"}} + {{end}} + {{if and $isReviewFile $file.HasChangedSinceLastReview}} + {{ctx.Locale.Tr "repo.pulls.has_changed_since_last_review"}} + {{end}} + {{if not (or $file.IsIncomplete $file.IsBin $file.IsSubmodule)}} + + + {{end}} + {{if and (not $file.IsSubmodule) (not $.PageIsWiki)}} + {{if $file.IsDeleted}} + {{ctx.Locale.Tr "repo.diff.view_file"}} + {{else}} + {{ctx.Locale.Tr "repo.diff.view_file"}} + {{if and $.HeadBranchIsEditable (not $file.IsLFSFile)}} + {{ctx.Locale.Tr "repo.editor.edit_this_file"}} + {{end}} + {{end}} + {{end}} + {{if $isReviewFile}} + + {{end}} +
+

+
+
+ {{if or $file.IsIncomplete $file.IsBin}} +
+ {{if $file.IsIncomplete}} + {{if $file.IsIncompleteLineTooLong}} + {{ctx.Locale.Tr "repo.diff.file_suppressed_line_too_long"}} + {{else}} + {{ctx.Locale.Tr "repo.diff.file_suppressed"}} + {{ctx.Locale.Tr "repo.diff.load"}} + {{end}} + {{else}} + {{ctx.Locale.Tr "repo.diff.bin_not_shown"}} + {{end}} +
+ {{else}} + + {{if $.IsSplitStyle}} + {{template "repo/diff/section_split" dict "file" . "root" $}} + {{else}} + {{template "repo/diff/section_unified" dict "file" . "root" $}} + {{end}} +
+ {{end}} +
+ {{if $showFileViewToggle}} + {{/* for image or CSV, it can have a horizontal scroll bar, there won't be review comment context menu (position absolute) which would be clipped by "overflow" */}} +
+ + {{if $isImage}} + {{template "repo/diff/image_diff" dict "file" . "root" $ "blobBase" $blobBase "blobHead" $blobHead "sniffedTypeBase" $sniffedTypeBase "sniffedTypeHead" $sniffedTypeHead}} + {{else}} + {{template "repo/diff/csv_diff" dict "file" . "root" $ "blobBase" $blobBase "blobHead" $blobHead "sniffedTypeBase" $sniffedTypeBase "sniffedTypeHead" $sniffedTypeHead}} + {{end}} +
+
+ {{end}} +
+
+ {{end}} + + {{if .Diff.IsIncomplete}} +
+

+ {{ctx.Locale.Tr "repo.diff.too_many_files"}} + {{ctx.Locale.Tr "repo.diff.show_more"}} +

+
+ {{end}} +
+ {{end}} +
+ + {{if and (not $.Repository.IsArchived) (not .DiffNotAvailable)}} + + {{end}} + {{if (not .DiffNotAvailable)}} + {{template "repo/issue/view_content/reference_issue_dialog" .}} + {{end}} +
-- cgit v1.2.3