|
| 1 | +{{$showFileTree := (and (not .DiffNotAvailable) (gt .Diff.NumFiles 1))}} |
1 | 2 | <div> |
2 | 3 | <div class="diff-detail-box diff-box"> |
3 | 4 | <div class="gt-df gt-ac gt-fw"> |
4 | | - {{if not .DiffNotAvailable}} |
| 5 | + {{if $showFileTree}} |
5 | 6 | <button class="diff-toggle-file-tree-button gt-df gt-ac not-mobile" data-show-text="{{ctx.Locale.Tr "repo.diff.show_file_tree"}}" data-hide-text="{{ctx.Locale.Tr "repo.diff.hide_file_tree"}}"> |
6 | 7 | {{/* the icon meaning is reversed here, "octicon-sidebar-collapse" means show the file tree */}} |
7 | 8 | {{svg "octicon-sidebar-collapse" 20 "icon gt-hidden"}} |
|
15 | 16 | diffTreeBtn.querySelector(diffTreeIcon).classList.remove('gt-hidden'); |
16 | 17 | diffTreeBtn.setAttribute('data-tooltip-content', diffTreeBtn.getAttribute(diffTreeVisible ? 'data-hide-text' : 'data-show-text')); |
17 | 18 | </script> |
| 19 | + {{end}} |
| 20 | + {{if not .DiffNotAvailable}} |
18 | 21 | <div class="diff-detail-stats gt-df gt-ac gt-fw"> |
19 | 22 | {{svg "octicon-diff" 16 "gt-mr-2"}}{{ctx.Locale.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}} |
20 | 23 | </div> |
|
85 | 88 | <div id="diff-file-list"></div> |
86 | 89 | {{end}} |
87 | 90 | <div id="diff-container"> |
88 | | - {{if .DiffNotAvailable}} |
89 | | - <h4>{{ctx.Locale.Tr "repo.diff.data_not_available"}}</h4> |
90 | | - {{else}} |
| 91 | + {{if $showFileTree}} |
91 | 92 | <div id="diff-file-tree" class="gt-hidden"></div> |
92 | 93 | <script> |
93 | 94 | if (diffTreeVisible) document.getElementById('diff-file-tree').classList.remove('gt-hidden'); |
94 | 95 | </script> |
| 96 | + {{end}} |
| 97 | + {{if .DiffNotAvailable}} |
| 98 | + <h4>{{ctx.Locale.Tr "repo.diff.data_not_available"}}</h4> |
| 99 | + {{else}} |
95 | 100 | <div id="diff-file-boxes" class="sixteen wide column"> |
96 | 101 | {{range $i, $file := .Diff.Files}} |
97 | 102 | {{/*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*/}} |
|
0 commit comments