Skip to content

Commit ed8b731

Browse files
authored
Merge branch 'main' into improve_file_tree
2 parents cca6ee7 + e544a27 commit ed8b731

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

routers/web/org/teams.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ func NewTeam(ctx *context.Context) {
276276
ctx.Data["PageIsOrgTeamsNew"] = true
277277
ctx.Data["Team"] = &org_model.Team{}
278278
ctx.Data["Units"] = unit_model.Units
279+
if err := shared_user.LoadHeaderCount(ctx); err != nil {
280+
ctx.ServerError("LoadHeaderCount", err)
281+
return
282+
}
279283
ctx.HTML(http.StatusOK, tplTeamNew)
280284
}
281285

@@ -463,6 +467,10 @@ func EditTeam(ctx *context.Context) {
463467
ctx.ServerError("LoadUnits", err)
464468
return
465469
}
470+
if err := shared_user.LoadHeaderCount(ctx); err != nil {
471+
ctx.ServerError("LoadHeaderCount", err)
472+
return
473+
}
466474
ctx.Data["Team"] = ctx.Org.Team
467475
ctx.Data["Units"] = unit_model.Units
468476
ctx.HTML(http.StatusOK, tplTeamNew)

templates/repo/diff/box.tmpl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
{{$showFileTree := (and (not .DiffNotAvailable) (gt .Diff.NumFiles 1))}}
12
<div>
23
<div class="diff-detail-box diff-box">
34
<div class="gt-df gt-ac gt-fw">
4-
{{if not .DiffNotAvailable}}
5+
{{if $showFileTree}}
56
<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"}}">
67
{{/* the icon meaning is reversed here, "octicon-sidebar-collapse" means show the file tree */}}
78
{{svg "octicon-sidebar-collapse" 20 "icon gt-hidden"}}
@@ -15,6 +16,8 @@
1516
diffTreeBtn.querySelector(diffTreeIcon).classList.remove('gt-hidden');
1617
diffTreeBtn.setAttribute('data-tooltip-content', diffTreeBtn.getAttribute(diffTreeVisible ? 'data-hide-text' : 'data-show-text'));
1718
</script>
19+
{{end}}
20+
{{if not .DiffNotAvailable}}
1821
<div class="diff-detail-stats gt-df gt-ac gt-fw">
1922
{{svg "octicon-diff" 16 "gt-mr-2"}}{{ctx.Locale.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}}
2023
</div>
@@ -85,13 +88,15 @@
8588
<div id="diff-file-list"></div>
8689
{{end}}
8790
<div id="diff-container">
88-
{{if .DiffNotAvailable}}
89-
<h4>{{ctx.Locale.Tr "repo.diff.data_not_available"}}</h4>
90-
{{else}}
91+
{{if $showFileTree}}
9192
<div id="diff-file-tree" class="gt-hidden"></div>
9293
<script>
9394
if (diffTreeVisible) document.getElementById('diff-file-tree').classList.remove('gt-hidden');
9495
</script>
96+
{{end}}
97+
{{if .DiffNotAvailable}}
98+
<h4>{{ctx.Locale.Tr "repo.diff.data_not_available"}}</h4>
99+
{{else}}
95100
<div id="diff-file-boxes" class="sixteen wide column">
96101
{{range $i, $file := .Diff.Files}}
97102
{{/*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*/}}

web_src/css/repo.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2734,6 +2734,9 @@ tbody.commit-list {
27342734
#diff-file-boxes {
27352735
flex: 1;
27362736
max-width: 100%;
2737+
display: flex;
2738+
flex-direction: column;
2739+
gap: 8px;
27372740
}
27382741

27392742
#diff-file-tree {

0 commit comments

Comments
 (0)