Skip to content

Commit cada5c8

Browse files
committed
temp fix
1 parent 2aa1b19 commit cada5c8

File tree

6 files changed

+128
-134
lines changed

6 files changed

+128
-134
lines changed

templates/repo/home.tmpl

Lines changed: 42 additions & 41 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-
{{template "repo/code/recently_pushed_new_branches" .}}
76

8-
<div class="repo-home-content">
9-
<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>
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)}}
1813
{{end}}
19-
{{$n := len .TreeNames}}
20-
{{$l := Eval $n "-" 1}}
21-
{{$isHomepage := (eq $n 0)}}
14+
</div>
15+
{{end}}
2216

23-
{{template "repo/sub_menu" .}}
17+
{{template "repo/code/recently_pushed_new_branches" .}}
2418

25-
<div class="repo-button-row" data-is-homepage="{{$isHomepage}}">
19+
{{$treeNamesLen := len .TreeNames}}
20+
{{$isTreePathRoot := eq $treeNamesLen 0}}
21+
{{$showSidebar := $isTreePathRoot}}
22+
<div class="{{Iif $showSidebar "repo-grid-filelist-sidebar" "repo-grid-filelist-only"}}">
23+
<div class="repo-home-filelist">
24+
{{template "repo/sub_menu" .}}
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 $showSidebar}}
144+
<div class="repo-home-sidebar-top">{{template "repo/home_sidebar_top" .}}</div>
145+
<div class="repo-home-sidebar-bottom">{{template "repo/home_sidebar_bottom" .}}</div>
145146
{{end}}
146147
</div>
147148
</div>

templates/repo/home_sidebar_foot.tmpl renamed to templates/repo/home_sidebar_bottom.tmpl

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
{{if .LatestRelease}}
1+
<div class="flex-list">
2+
{{if .LatestRelease}}
23
<div class="flex-item">
34
<div class="flex-item-main">
45
<div class="flex-item-title">
@@ -25,9 +26,9 @@
2526
</div>
2627
</div>
2728
</div>
28-
{{end}}
29+
{{end}}
2930

30-
{{if and (not .IsEmptyRepo) .LanguageStats}}
31+
{{if and (not .IsEmptyRepo) .LanguageStats}}
3132
<div class="flex-item">
3233
<div class="flex-item-main">
3334
<div class="flex-item-title">
@@ -45,11 +46,7 @@
4546
<div class="item">
4647
<i class="color-icon" style="background-color: {{.Color}}"></i>
4748
<span class="tw-font-semibold">
48-
{{if eq .Language "other"}}
49-
{{ctx.Locale.Tr "repo.language_other"}}
50-
{{else}}
51-
{{.Language}}
52-
{{end}}
49+
{{Iif (eq .Language "other") (ctx.Locale.Tr "repo.language_other") .Language}}
5350
</span>
5451
{{.Percentage}}%
5552
</div>
@@ -58,4 +55,5 @@
5855
</div>
5956
</div>
6057
</div>
61-
{{end}}
58+
{{end}}
59+
</div>

templates/repo/home_sidebar_head.tmpl

Lines changed: 0 additions & 65 deletions
This file was deleted.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<div class="flex-list">
2+
<div class="flex-item tw-pt-0">
3+
<form class="ignore-dirty tw-flex tw-flex-1 tw-mt-1" action="{{.RepoLink}}/search" method="get">
4+
<div class="ui small action input tw-flex-1">
5+
<input name="q" size="10" placeholder="{{ctx.Locale.Tr "search.code_kind"}}">
6+
{{template "shared/search/button"}}
7+
</div>
8+
</form>
9+
</div>
10+
11+
<div class="flex-item">
12+
<div class="flex-item-main">
13+
<div class="flex-item-title">
14+
{{ctx.Locale.Tr "repo.repo_desc"}}
15+
</div>
16+
{{if and (not .HideRepoInfo) (not .IsBlame)}}
17+
<div class="flex-item-body repo-description tw-break-anywhere tw-gap-2 tw-mt-2">
18+
{{- $description := .Repository.DescriptionHTML ctx -}}
19+
{{if $description}}{{$description | RenderCodeBlock}}{{else}}{{ctx.Locale.Tr "repo.repo_no_desc"}}{{end}}
20+
{{if .Repository.Website}}{{svg "octicon-link"}}<a href="{{.Repository.Website}}">{{.Repository.Website}}</a>{{end}}
21+
</div>
22+
<div class="tw-flex tw-items-center tw-flex-wrap tw-gap-2 tw-my-2" id="repo-topics">
23+
{{/* !!!! it SHOULD and MUST match the code in issue-home.js */}}
24+
{{range .Topics}}<a class="repo-topic ui large label gt-ellipsis" title={{.Name}} href="{{AppSubUrl}}/explore/repos?q={{.Name}}&topic=1">{{.Name}}</a>{{end}}
25+
</div>
26+
{{if and .Permission.IsAdmin (not .Repository.IsArchived)}}
27+
<button id="manage_topic" class="btn interact-fg tw-text-12">{{ctx.Locale.Tr "repo.topic.manage_topics"}}</button>
28+
{{end}}
29+
{{end}}
30+
{{if and .Permission.IsAdmin (not .Repository.IsArchived)}}
31+
<div class="ui form tw-hidden flex-item-body tw-gap-2 tw-my-2" id="topic_edit">
32+
<div class="ui fluid multiple search selection dropdown tw-flex-wrap tw-flex-1">
33+
<input type="hidden" name="topics" value="{{range $i, $v := .Topics}}{{.Name}}{{if Eval $i "+" 1 "<" (len $.Topics)}},{{end}}{{end}}">
34+
{{range .Topics}}
35+
{{/* keep the same layout as Fomantic UI generated labels */}}
36+
<a class="ui label transition visible tw-cursor-default tw-inline-block repo-topic" data-value="{{.Name}}">{{.Name}}{{svg "octicon-x" 16 "delete icon"}}</a>
37+
{{end}}
38+
<div class="text"></div>
39+
</div>
40+
<div>
41+
<button class="ui primary button" id="save_topic" data-link="{{.RepoLink}}/topics">{{ctx.Locale.Tr "save"}}</button>
42+
<button class="ui basic button" id="cancel_topic_edit">{{ctx.Locale.Tr "cancel"}}</button>
43+
</div>
44+
</div>
45+
{{end}}
46+
{{if .ReadmeExist}}
47+
<div class="flex-item-body tw-mt-2">
48+
<a class="tw-flex tw-items-center tw-gap-2 muted" href="{{.TreeLink}}/{{.FileName}}">
49+
{{svg "octicon-book"}}{{ctx.Locale.Tr "readme"}}
50+
</a>
51+
</div>
52+
{{end}}
53+
{{if .DetectedRepoLicenses}}
54+
<div class="flex-item-body">
55+
<a class="tw-flex tw-items-center tw-gap-2 muted" href="{{.RepoLink}}/src/{{.Repository.DefaultBranch}}/{{PathEscapeSegments .LicenseFileName}}" data-tooltip-placement="top" data-tooltip-content="{{StringUtils.Join .DetectedRepoLicenses ", "}}">
56+
{{svg "octicon-law"}}{{if eq (len .DetectedRepoLicenses) 1}}{{index .DetectedRepoLicenses 0}}{{else}}{{ctx.Locale.Tr "repo.multiple_licenses"}}{{end}}
57+
</a>
58+
</div>
59+
{{end}}
60+
{{if .CitiationExist}}
61+
<div class="flex-item-body">
62+
<a class="tw-flex tw-items-center tw-gap-2 muted" id="cite-repo-button">
63+
{{svg "octicon-cross-reference"}}{{ctx.Locale.Tr "repo.cite_this_repo"}}
64+
</a>
65+
</div>
66+
{{end}}
67+
</div>
68+
</div>
69+
</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;

web_src/css/repo/home.css

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,45 @@
1-
.repo-home-content {
1+
.repo-grid-filelist-sidebar {
22
display: grid;
33
gap: 10px;
44
grid-template-columns: auto 300px;
55
grid-template-rows: auto auto 1fr;
66
}
77

8-
.repo-home-main {
8+
.repo-grid-filelist-sidebar .repo-home-filelist {
99
grid-column: 1;
1010
grid-row: 1 / 4;
1111
}
1212

13-
.repo-home-head {
13+
.repo-grid-filelist-sidebar .repo-home-sidebar-top {
1414
grid-column: 2;
1515
grid-row: 1;
16-
padding-left: 10px;
1716
}
18-
19-
.repo-home-foot {
17+
.repo-grid-filelist-sidebar .repo-home-sidebar-bottom {
2018
grid-column: 2;
2119
grid-row: 2;
22-
padding-left: 10px;
2320
}
24-
25-
.repo-home-foot > :first-child {
21+
.repo-home-sidebar-bottom > :first-child {
2622
border-top: 1px solid var(--color-secondary); /* same to .flex-list > .flex-item + .flex-item */
2723
}
2824

2925
@media (max-width: 767.98px) {
30-
.repo-home-content {
26+
.repo-grid-filelist-sidebar {
3127
grid-template-columns: 100%;
3228
grid-template-rows: auto auto auto;
3329
}
34-
.repo-home-main {
30+
.repo-grid-filelist-sidebar .repo-home-filelist {
3531
grid-column: 1;
3632
grid-row: 2;
3733
}
38-
.repo-home-head {
34+
.repo-grid-filelist-sidebar .repo-home-sidebar-top {
3935
grid-column: 1;
4036
grid-row: 1;
4137
}
42-
.repo-home-foot {
38+
.repo-grid-filelist-sidebar .repo-home-sidebar-bottom {
4339
grid-column: 1;
4440
grid-row: 3;
4541
}
46-
.repo-home-foot > :first-child {
42+
.repo-home-sidebar-bottom > :first-child {
4743
border-top: 0;
4844
}
4945
}
@@ -68,7 +64,6 @@
6864

6965
.language-stats-details .item {
7066
height: 30px;
71-
line-height: var(--line-height-default);
7267
display: flex;
7368
align-items: center;
7469
justify-content: center;

0 commit comments

Comments
 (0)