|
3 | 3 | {{template "repo/header" .}} |
4 | 4 | <div class="ui container {{if .IsBlame}}fluid padded{{end}}"> |
5 | 5 | {{template "base/alert" .}} |
6 | | - {{template "repo/code/recently_pushed_new_branches" .}} |
7 | 6 |
|
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)}} |
18 | 13 | {{end}} |
19 | | - {{$n := len .TreeNames}} |
20 | | - {{$l := Eval $n "-" 1}} |
21 | | - {{$isHomepage := (eq $n 0)}} |
| 14 | + </div> |
| 15 | + {{end}} |
22 | 16 |
|
23 | | - {{template "repo/sub_menu" .}} |
| 17 | + {{template "repo/code/recently_pushed_new_branches" .}} |
24 | 18 |
|
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"> |
26 | 26 | <div class="repo-button-row-left"> |
27 | 27 | {{$branchDropdownCurrentRefType := "branch"}} |
28 | 28 | {{$branchDropdownCurrentRefShortName := .BranchName}} |
29 | 29 | {{if .IsViewTag}} |
30 | | - {{$branchDropdownCurrentRefType = "tag"}} |
31 | | - {{$branchDropdownCurrentRefShortName = .TagName}} |
| 30 | + {{$branchDropdownCurrentRefType = "tag"}} |
| 31 | + {{$branchDropdownCurrentRefShortName = .TagName}} |
32 | 32 | {{end}} |
33 | 33 | {{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 |
43 | 43 | }} |
44 | 44 | {{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}} |
45 | 45 | {{$cmpBranch := ""}} |
|
53 | 53 | {{svg "octicon-git-pull-request"}} |
54 | 54 | </a> |
55 | 55 | {{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}} |
58 | 59 | <a href="{{.Repository.Link}}/find/{{.BranchNameSubURL}}" class="ui compact basic button">{{ctx.Locale.Tr "repo.find_file.go_to_file"}}</a> |
59 | 60 | {{end}} |
60 | 61 |
|
|
78 | 79 | </button> |
79 | 80 | {{end}} |
80 | 81 |
|
81 | | - {{if and $isHomepage (.Repository.IsTemplate)}} |
| 82 | + {{if and $isTreePathRoot .Repository.IsTemplate}} |
82 | 83 | <a role="button" class="ui primary compact button" href="{{AppSubUrl}}/repo/create?template_id={{.Repository.ID}}"> |
83 | 84 | {{ctx.Locale.Tr "repo.use_template"}} |
84 | 85 | </a> |
85 | 86 | {{end}} |
86 | | - {{if not $isHomepage}} |
| 87 | + |
| 88 | + {{if not $isTreePathRoot}} |
| 89 | + {{$treeNameIdxLast := Eval $treeNamesLen "-" 1}} |
87 | 90 | <span class="breadcrumb repo-path tw-ml-1"> |
88 | 91 | <a class="section" href="{{.RepoLink}}/src/{{.BranchNameSubURL}}" title="{{.Repository.Name}}">{{StringUtils.EllipsisString .Repository.Name 30}}</a> |
89 | 92 | {{- range $i, $v := .TreeNames -}} |
90 | 93 | <span class="breadcrumb-divider">/</span> |
91 | | - {{- if eq $i $l -}} |
| 94 | + {{- if eq $i $treeNameIdxLast -}} |
92 | 95 | <span class="active section" title="{{$v}}">{{$v}}</span> |
93 | 96 | <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> |
94 | 97 | {{- else -}} |
|
98 | 101 | </span> |
99 | 102 | {{end}} |
100 | 103 | </div> |
| 104 | + |
101 | 105 | <div class="repo-button-row-right"> |
102 | 106 | <!-- Only show clone panel in repository home page --> |
103 | | - {{if $isHomepage}} |
| 107 | + {{if $isTreePathRoot}} |
104 | 108 | <div class="clone-panel ui action tiny input"> |
105 | 109 | {{template "repo/clone_buttons" .}} |
106 | 110 | <button class="ui small jump dropdown icon button" data-tooltip-content="{{ctx.Locale.Tr "repo.more_operations"}}"> |
|
120 | 124 | </div> |
121 | 125 | {{template "repo/cite/cite_modal" .}} |
122 | 126 | {{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 */}} |
124 | 128 | <a class="ui button" href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}/{{.TreePath | PathEscapeSegments}}"> |
125 | 129 | {{svg "octicon-history" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.file_history"}} |
126 | 130 | </a> |
|
135 | 139 | {{template "repo/view_list" .}} |
136 | 140 | {{end}} |
137 | 141 | </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> |
145 | 146 | {{end}} |
146 | 147 | </div> |
147 | 148 | </div> |
|
0 commit comments