|
44 | 44 | {{end}}
|
45 | 45 | </ol>
|
46 | 46 | {{range $i, $file := .Diff.Files}}
|
47 |
| - {{if $file.IsIncomplete}} |
48 |
| - <div class="diff-file-box diff-box file-content mt-3"> |
49 |
| - <h4 class="ui top attached normal header rounded"> |
| 47 | + {{$blobBase := call $.GetBlobByPathForCommit $.BaseCommit $file.OldName}} |
| 48 | + {{$blobHead := call $.GetBlobByPathForCommit $.HeadCommit $file.Name}} |
| 49 | + {{$isImage := or (call $.IsBlobAnImage $blobBase) (call $.IsBlobAnImage $blobHead)}} |
| 50 | + {{$isCsv := (call $.IsCsvFile $file)}} |
| 51 | + {{$showFileViewToggle := or $isImage (and (not $file.IsIncomplete) $isCsv)}} |
| 52 | + <div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}} mt-3" id="diff-{{.Index}}"> |
| 53 | + <h4 class="diff-file-header sticky-2nd-row ui top attached normal header df ac sb"> |
| 54 | + <div class="df ac"> |
50 | 55 | <a role="button" class="fold-file muted mr-2">
|
51 | 56 | {{svg "octicon-chevron-down" 18}}
|
52 | 57 | </a>
|
53 |
| - <div class="bold ui left df ac"> |
54 |
| - {{template "repo/diff/stats" dict "file" . "root" $}} |
55 |
| - </div> |
56 |
| - <span class="file mono">{{$file.Name}}</span> |
57 |
| - <div class="diff-file-header-actions df ac"> |
58 |
| - <div class="text grey"> |
59 |
| - {{if $file.IsIncompleteLineTooLong}} |
60 |
| - {{$.i18n.Tr "repo.diff.file_suppressed_line_too_long"}} |
61 |
| - {{else}} |
62 |
| - {{$.i18n.Tr "repo.diff.file_suppressed"}} |
63 |
| - {{end}} |
64 |
| - </div> |
65 |
| - {{if $file.IsProtected}} |
66 |
| - <span class="ui basic label">{{$.i18n.Tr "repo.diff.protected"}}</span> |
67 |
| - {{end}} |
68 |
| - {{if and (not $file.IsSubmodule) (not $.PageIsWiki)}} |
69 |
| - {{if $file.IsDeleted}} |
70 |
| - <a class="ui basic tiny button" rel="nofollow" href="{{EscapePound $.BeforeSourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a> |
71 |
| - {{else}} |
72 |
| - <a class="ui basic tiny button" rel="nofollow" href="{{EscapePound $.SourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a> |
73 |
| - {{end}} |
74 |
| - {{end}} |
75 |
| - </div> |
76 |
| - </h4> |
77 |
| - </div> |
78 |
| - {{else}} |
79 |
| - <div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}} mt-3" id="diff-{{.Index}}"> |
80 |
| - <h4 class="diff-file-header sticky-2nd-row ui top attached normal header df ac sb"> |
81 |
| - <div class="df ac"> |
82 |
| - {{$blobBase := call $.GetBlobByPathForCommit $.BaseCommit $file.OldName}} |
83 |
| - {{$blobHead := call $.GetBlobByPathForCommit $.HeadCommit $file.Name}} |
84 |
| - {{$isImage := or (call $.IsBlobAnImage $blobBase) (call $.IsBlobAnImage $blobHead)}} |
85 |
| - {{$isCsv := (call $.IsCsvFile $file)}} |
86 |
| - {{$showFileViewToggle := or $isImage $isCsv}} |
87 |
| - <a role="button" class="fold-file muted mr-2"> |
88 |
| - {{svg "octicon-chevron-down" 18}} |
89 |
| - </a> |
90 |
| - <div class="bold df ac"> |
91 |
| - {{if $file.IsBin}} |
92 |
| - <span class="ml-1 mr-3"> |
93 |
| - {{$.i18n.Tr "repo.diff.bin"}} |
94 |
| - </span> |
95 |
| - {{else}} |
96 |
| - {{template "repo/diff/stats" dict "file" . "root" $}} |
97 |
| - {{end}} |
98 |
| - </div> |
99 |
| - <span class="file mono">{{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}}{{if .IsLFSFile}} ({{$.i18n.Tr "repo.stored_lfs"}}){{end}}</span> |
100 |
| - </div> |
101 |
| - <div class="diff-file-header-actions df ac"> |
102 |
| - {{if $showFileViewToggle}} |
103 |
| - <div class="ui compact icon buttons"> |
104 |
| - <span class="ui tiny basic button poping up file-view-toggle" data-toggle-selector="#diff-source-{{$i}}" data-content="{{$.i18n.Tr "repo.file_view_source"}}" data-position="bottom center" data-variation="tiny inverted">{{svg "octicon-code"}}</span> |
105 |
| - <span class="ui tiny basic button poping up file-view-toggle active" data-toggle-selector="#diff-rendered-{{$i}}" data-content="{{$.i18n.Tr "repo.file_view_rendered"}}" data-position="bottom center" data-variation="tiny inverted">{{svg "octicon-file"}}</span> |
106 |
| - </div> |
107 |
| - {{end}} |
108 |
| - {{if $file.IsProtected}} |
109 |
| - <span class="ui basic label">{{$.i18n.Tr "repo.diff.protected"}}</span> |
110 |
| - {{end}} |
111 |
| - {{if and (not $file.IsSubmodule) (not $.PageIsWiki)}} |
112 |
| - {{if $file.IsDeleted}} |
113 |
| - <a class="ui basic tiny button" rel="nofollow" href="{{EscapePound $.BeforeSourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a> |
114 |
| - {{else}} |
115 |
| - <a class="ui basic tiny button" rel="nofollow" href="{{EscapePound $.SourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a> |
116 |
| - {{end}} |
117 |
| - {{end}} |
118 |
| - </div> |
119 |
| - </h4> |
120 |
| - <div class="diff-file-body ui attached unstackable table segment"> |
121 |
| - <div id="diff-source-{{$i}}" class="file-body file-code code-diff{{if $.IsSplitStyle}} code-diff-split{{else}} code-diff-unified{{end}}{{if $showFileViewToggle}} hide{{end}}"> |
| 58 | + <div class="bold df ac"> |
122 | 59 | {{if $file.IsBin}}
|
123 |
| - <div class="diff-file-body binary" style="padding: 5px 10px;">{{$.i18n.Tr "repo.diff.bin_not_shown"}}</div> |
| 60 | + <span class="ml-1 mr-3"> |
| 61 | + {{$.i18n.Tr "repo.diff.bin"}} |
| 62 | + </span> |
124 | 63 | {{else}}
|
125 |
| - <table class="chroma"> |
126 |
| - {{if $.IsSplitStyle}} |
127 |
| - {{template "repo/diff/section_split" dict "file" . "root" $}} |
128 |
| - {{else}} |
129 |
| - {{template "repo/diff/section_unified" dict "file" . "root" $}} |
130 |
| - {{end}} |
131 |
| - </table> |
| 64 | + {{template "repo/diff/stats" dict "file" . "root" $}} |
132 | 65 | {{end}}
|
133 | 66 | </div>
|
| 67 | + <span class="file mono">{{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}}{{if .IsLFSFile}} ({{$.i18n.Tr "repo.stored_lfs"}}){{end}}</span> |
| 68 | + </div> |
| 69 | + <div class="diff-file-header-actions df ac"> |
134 | 70 | {{if $showFileViewToggle}}
|
135 |
| - <div id="diff-rendered-{{$i}}" class="file-body file-code {{if $.IsSplitStyle}} code-diff-split{{else}} code-diff-unified{{end}}"> |
136 |
| - <table class="chroma w-100"> |
137 |
| - {{if $isImage}} |
138 |
| - {{template "repo/diff/image_diff" dict "file" . "root" $ "blobBase" $blobBase "blobHead" $blobHead}} |
| 71 | + <div class="ui compact icon buttons"> |
| 72 | + <span class="ui tiny basic button poping up file-view-toggle" data-toggle-selector="#diff-source-{{$i}}" data-content="{{$.i18n.Tr "repo.file_view_source"}}" data-position="bottom center" data-variation="tiny inverted">{{svg "octicon-code"}}</span> |
| 73 | + <span class="ui tiny basic button poping up file-view-toggle active" data-toggle-selector="#diff-rendered-{{$i}}" data-content="{{$.i18n.Tr "repo.file_view_rendered"}}" data-position="bottom center" data-variation="tiny inverted">{{svg "octicon-file"}}</span> |
| 74 | + </div> |
| 75 | + {{end}} |
| 76 | + {{if $file.IsProtected}} |
| 77 | + <span class="ui basic label">{{$.i18n.Tr "repo.diff.protected"}}</span> |
| 78 | + {{end}} |
| 79 | + {{if and (not $file.IsSubmodule) (not $.PageIsWiki)}} |
| 80 | + {{if $file.IsDeleted}} |
| 81 | + <a class="ui basic tiny button" rel="nofollow" href="{{EscapePound $.BeforeSourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a> |
| 82 | + {{else}} |
| 83 | + <a class="ui basic tiny button" rel="nofollow" href="{{EscapePound $.SourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a> |
| 84 | + {{end}} |
| 85 | + {{end}} |
| 86 | + </div> |
| 87 | + </h4> |
| 88 | + <div class="diff-file-body ui attached unstackable table segment"> |
| 89 | + <div id="diff-source-{{$i}}" class="file-body file-code code-diff{{if $.IsSplitStyle}} code-diff-split{{else}} code-diff-unified{{end}}{{if $showFileViewToggle}} hide{{end}}"> |
| 90 | + {{if or $file.IsIncomplete $file.IsBin}} |
| 91 | + <div class="diff-file-body binary" style="padding: 5px 10px;"> |
| 92 | + {{if $file.IsIncomplete}} |
| 93 | + {{if $file.IsIncompleteLineTooLong}} |
| 94 | + {{$.i18n.Tr "repo.diff.file_suppressed_line_too_long"}} |
139 | 95 | {{else}}
|
140 |
| - {{template "repo/diff/csv_diff" dict "file" . "root" $}} |
| 96 | + {{$.i18n.Tr "repo.diff.file_suppressed"}} |
141 | 97 | {{end}}
|
142 |
| - </table> |
| 98 | + {{else}} |
| 99 | + {{$.i18n.Tr "repo.diff.bin_not_shown"}} |
| 100 | + {{end}} |
143 | 101 | </div>
|
| 102 | + {{else}} |
| 103 | + <table class="chroma"> |
| 104 | + {{if $.IsSplitStyle}} |
| 105 | + {{template "repo/diff/section_split" dict "file" . "root" $}} |
| 106 | + {{else}} |
| 107 | + {{template "repo/diff/section_unified" dict "file" . "root" $}} |
| 108 | + {{end}} |
| 109 | + </table> |
144 | 110 | {{end}}
|
145 | 111 | </div>
|
| 112 | + {{if $showFileViewToggle}} |
| 113 | + <div id="diff-rendered-{{$i}}" class="file-body file-code {{if $.IsSplitStyle}} code-diff-split{{else}} code-diff-unified{{end}}"> |
| 114 | + <table class="chroma w-100"> |
| 115 | + {{if $isImage}} |
| 116 | + {{template "repo/diff/image_diff" dict "file" . "root" $ "blobBase" $blobBase "blobHead" $blobHead}} |
| 117 | + {{else}} |
| 118 | + {{template "repo/diff/csv_diff" dict "file" . "root" $}} |
| 119 | + {{end}} |
| 120 | + </table> |
| 121 | + </div> |
| 122 | + {{end}} |
146 | 123 | </div>
|
147 |
| - {{end}} |
| 124 | + </div> |
148 | 125 | {{end}}
|
149 | 126 |
|
150 | 127 | {{if .Diff.IsIncomplete}}
|
|
0 commit comments