Skip to content

Commit 0538c5a

Browse files
committed
temp fix
1 parent 2aa1b19 commit 0538c5a

File tree

7 files changed

+132
-145
lines changed

7 files changed

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

web_src/css/repo.css

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -422,14 +422,6 @@ td .commit-summary {
422422
border-radius: 0 0 var(--border-radius) var(--border-radius);
423423
}
424424

425-
.repository.file.list .sidebar {
426-
padding-left: 0;
427-
}
428-
429-
.repository.file.list .sidebar .svg {
430-
width: 16px;
431-
}
432-
433425
.repo-editor-header {
434426
width: 100%;
435427
}
@@ -2162,10 +2154,6 @@ td .commit-summary {
21622154
justify-content: flex-end;
21632155
}
21642156

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

0 commit comments

Comments
 (0)