Skip to content

Commit 060a55a

Browse files
committed
temp fix
1 parent 2aa1b19 commit 060a55a

File tree

2 files changed

+41
-44
lines changed

2 files changed

+41
-44
lines changed

templates/repo/home.tmpl

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,43 @@
33
{{template "repo/header" .}}
44
<div class="ui container {{if .IsBlame}}fluid padded{{end}}">
55
{{template "base/alert" .}}
6+
7+
{{if .Repository.IsArchived}}
8+
<div class="ui warning message tw-text-center">
9+
{{if .Repository.ArchivedUnix.IsZero}}
10+
{{ctx.Locale.Tr "repo.archive.title"}}
11+
{{else}}
12+
{{ctx.Locale.Tr "repo.archive.title_date" (DateUtils.AbsoluteLong .Repository.ArchivedUnix)}}
13+
{{end}}
14+
</div>
15+
{{end}}
16+
617
{{template "repo/code/recently_pushed_new_branches" .}}
718

19+
{{$treeNamesLen := len .TreeNames}}
20+
{{$isTreePathRoot := eq $treeNamesLen 0}}
21+
822
<div class="repo-home-content">
923
<div class="repo-home-main">
10-
{{if .Repository.IsArchived}}
11-
<div class="ui warning message tw-text-center">
12-
{{if .Repository.ArchivedUnix.IsZero}}
13-
{{ctx.Locale.Tr "repo.archive.title"}}
14-
{{else}}
15-
{{ctx.Locale.Tr "repo.archive.title_date" (DateUtils.AbsoluteLong .Repository.ArchivedUnix)}}
16-
{{end}}
17-
</div>
18-
{{end}}
19-
{{$n := len .TreeNames}}
20-
{{$l := Eval $n "-" 1}}
21-
{{$isHomepage := (eq $n 0)}}
22-
2324
{{template "repo/sub_menu" .}}
24-
25-
<div class="repo-button-row" data-is-homepage="{{$isHomepage}}">
25+
<div class="repo-button-row">
2626
<div class="repo-button-row-left">
2727
{{$branchDropdownCurrentRefType := "branch"}}
2828
{{$branchDropdownCurrentRefShortName := .BranchName}}
2929
{{if .IsViewTag}}
30-
{{$branchDropdownCurrentRefType = "tag"}}
31-
{{$branchDropdownCurrentRefShortName = .TagName}}
30+
{{$branchDropdownCurrentRefType = "tag"}}
31+
{{$branchDropdownCurrentRefShortName = .TagName}}
3232
{{end}}
3333
{{template "repo/branch_dropdown" dict
34-
"Repository" .Repository
35-
"ShowTabBranches" true
36-
"ShowTabTags" true
37-
"CurrentRefType" $branchDropdownCurrentRefType
38-
"CurrentRefShortName" $branchDropdownCurrentRefShortName
39-
"CurrentTreePath" .TreePath
40-
"RefLinkTemplate" "{RepoLink}/src/{RefType}/{RefShortName}/{TreePath}"
41-
"AllowCreateNewRef" .CanCreateBranch
42-
"ShowViewAllRefsEntry" true
34+
"Repository" .Repository
35+
"ShowTabBranches" true
36+
"ShowTabTags" true
37+
"CurrentRefType" $branchDropdownCurrentRefType
38+
"CurrentRefShortName" $branchDropdownCurrentRefShortName
39+
"CurrentTreePath" .TreePath
40+
"RefLinkTemplate" "{RepoLink}/src/{RefType}/{RefShortName}/{TreePath}"
41+
"AllowCreateNewRef" .CanCreateBranch
42+
"ShowViewAllRefsEntry" true
4343
}}
4444
{{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}}
4545
{{$cmpBranch := ""}}
@@ -53,8 +53,9 @@
5353
{{svg "octicon-git-pull-request"}}
5454
</a>
5555
{{end}}
56-
<!-- Show go to file and breadcrumbs if not on home page -->
57-
{{if $isHomepage}}
56+
57+
<!-- Show go to file if on home page -->
58+
{{if $isTreePathRoot}}
5859
<a href="{{.Repository.Link}}/find/{{.BranchNameSubURL}}" class="ui compact basic button">{{ctx.Locale.Tr "repo.find_file.go_to_file"}}</a>
5960
{{end}}
6061

@@ -78,17 +79,19 @@
7879
</button>
7980
{{end}}
8081

81-
{{if and $isHomepage (.Repository.IsTemplate)}}
82+
{{if and $isTreePathRoot .Repository.IsTemplate}}
8283
<a role="button" class="ui primary compact button" href="{{AppSubUrl}}/repo/create?template_id={{.Repository.ID}}">
8384
{{ctx.Locale.Tr "repo.use_template"}}
8485
</a>
8586
{{end}}
86-
{{if not $isHomepage}}
87+
88+
{{if not $isTreePathRoot}}
89+
{{$treeNameIdxLast := Eval $treeNamesLen "-" 1}}
8790
<span class="breadcrumb repo-path tw-ml-1">
8891
<a class="section" href="{{.RepoLink}}/src/{{.BranchNameSubURL}}" title="{{.Repository.Name}}">{{StringUtils.EllipsisString .Repository.Name 30}}</a>
8992
{{- range $i, $v := .TreeNames -}}
9093
<span class="breadcrumb-divider">/</span>
91-
{{- if eq $i $l -}}
94+
{{- if eq $i $treeNameIdxLast -}}
9295
<span class="active section" title="{{$v}}">{{$v}}</span>
9396
<button class="btn interact-fg tw-mx-1" data-clipboard-text="{{$.TreePath}}" data-tooltip-content="{{ctx.Locale.Tr "copy_path"}}">{{svg "octicon-copy" 14}}</button>
9497
{{- else -}}
@@ -98,9 +101,10 @@
98101
</span>
99102
{{end}}
100103
</div>
104+
101105
<div class="repo-button-row-right">
102106
<!-- Only show clone panel in repository home page -->
103-
{{if $isHomepage}}
107+
{{if $isTreePathRoot}}
104108
<div class="clone-panel ui action tiny input">
105109
{{template "repo/clone_buttons" .}}
106110
<button class="ui small jump dropdown icon button" data-tooltip-content="{{ctx.Locale.Tr "repo.more_operations"}}">
@@ -120,7 +124,7 @@
120124
</div>
121125
{{template "repo/cite/cite_modal" .}}
122126
{{end}}
123-
{{if and (not $isHomepage) (not .IsViewFile) (not .IsBlame)}}{{/* IsViewDirectory (not home), TODO: split the templates, avoid using "if" tricks */}}
127+
{{if and (not $isTreePathRoot) (not .IsViewFile) (not .IsBlame)}}{{/* IsViewDirectory (not home), TODO: split the templates, avoid using "if" tricks */}}
124128
<a class="ui button" href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}/{{.TreePath | PathEscapeSegments}}">
125129
{{svg "octicon-history" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.file_history"}}
126130
</a>
@@ -135,13 +139,10 @@
135139
{{template "repo/view_list" .}}
136140
{{end}}
137141
</div>
138-
{{if $isHomepage}}
139-
<div class="flex-list repo-home-head">
140-
{{template "repo/home_sidebar_head" .}}
141-
</div>
142-
<div class="flex-list repo-home-foot">
143-
{{template "repo/home_sidebar_foot" .}}
144-
</div>
142+
143+
{{if $isTreePathRoot}}
144+
{{template "repo/home_sidebar_head" .}}
145+
{{template "repo/home_sidebar_foot" .}}
145146
{{end}}
146147
</div>
147148
</div>

web_src/css/repo.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2162,10 +2162,6 @@ td .commit-summary {
21622162
justify-content: flex-end;
21632163
}
21642164

2165-
.repo-button-row[data-is-homepage="false"] .repo-button-row-right {
2166-
flex-grow: 0;
2167-
}
2168-
21692165
@media (max-width: 1200px) {
21702166
.repository:not(.wiki) .repo-button-row {
21712167
flex-direction: column;

0 commit comments

Comments
 (0)