|
5 | 5 | {{$hasTreeSidebar := not $isTreePathRoot}} |
6 | 6 | {{$showTreeSidebar := .RepoPreferences.ShowFileViewTreeSidebar}} |
7 | 7 | {{$hideTreeSidebar := not $showTreeSidebar}} |
8 | | -{{$hasAndShowTreeSidebar := and $hasTreeSidebar $showTreeSidebar}} |
9 | 8 | <div role="main" aria-label="{{.Title}}" class="page-content repository file list {{if .IsBlame}}blame{{end}}"> |
10 | 9 | {{template "repo/header" .}} |
11 | 10 | <div class="ui container {{if or $hasTreeSidebar .IsBlame}}fluid padded{{end}}"> |
|
29 | 28 | {{end}} |
30 | 29 |
|
31 | 30 | <div class="repo-home-filelist"> |
32 | | - {{template "repo/sub_menu" .}} |
33 | | - <div class="repo-button-row"> |
34 | | - <div class="repo-button-row-left"> |
35 | | - {{if $hasTreeSidebar}} |
36 | | - <button class="show-tree-sidebar-button ui compact basic button icon not-mobile {{if $showTreeSidebar}}tw-hidden{{end}}" title="{{ctx.Locale.Tr "repo.diff.show_file_tree"}}"> |
37 | | - {{svg "octicon-sidebar-collapse" 20 "icon"}} |
38 | | - </button> |
39 | | - {{end}} |
40 | | - {{template "repo/home_branch_dropdown" (dict "ctxData" . "containerClasses" (Iif $hasAndShowTreeSidebar "tw-hidden" ""))}} |
41 | | - {{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}} |
42 | | - {{$cmpBranch := ""}} |
43 | | - {{if ne .Repository.ID .BaseRepo.ID}} |
44 | | - {{$cmpBranch = printf "%s/%s:" (.Repository.OwnerName|PathEscape) (.Repository.Name|PathEscape)}} |
45 | | - {{end}} |
46 | | - {{$cmpBranch = print $cmpBranch (.BranchName|PathEscapeSegments)}} |
47 | | - {{$compareLink := printf "%s/compare/%s...%s" .BaseRepo.Link (.BaseRepo.DefaultBranch|PathEscapeSegments) $cmpBranch}} |
48 | | - <a id="new-pull-request" role="button" class="ui compact basic button {{if $hasAndShowTreeSidebar}}tw-hidden{{end}}" href="{{$compareLink}}" |
49 | | - data-tooltip-content="{{if .PullRequestCtx.Allowed}}{{ctx.Locale.Tr "repo.pulls.compare_changes"}}{{else}}{{ctx.Locale.Tr "action.compare_branch"}}{{end}}"> |
50 | | - {{svg "octicon-git-pull-request"}} |
51 | | - </a> |
52 | | - {{end}} |
53 | | - |
54 | | - <!-- Show go to file if on home page --> |
55 | | - {{if $isTreePathRoot}} |
56 | | - <a href="{{.Repository.Link}}/find/{{.BranchNameSubURL}}" class="ui compact basic button">{{ctx.Locale.Tr "repo.find_file.go_to_file"}}</a> |
57 | | - {{end}} |
58 | | - |
59 | | - {{if and .CanWriteCode .IsViewBranch (not .Repository.IsMirror) (not .Repository.IsArchived) (not .IsViewFile)}} |
60 | | - <button class="add-file-dropdown ui dropdown basic compact jump button {{if $hasAndShowTreeSidebar}}tw-hidden{{end}}"{{if not .Repository.CanEnableEditor}} disabled{{end}}> |
61 | | - {{ctx.Locale.Tr "repo.editor.add_file"}} |
62 | | - {{svg "octicon-triangle-down" 14 "dropdown icon"}} |
63 | | - <div class="menu"> |
64 | | - <a class="item" href="{{.RepoLink}}/_new/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}"> |
65 | | - {{ctx.Locale.Tr "repo.editor.new_file"}} |
66 | | - </a> |
67 | | - {{if .RepositoryUploadEnabled}} |
68 | | - <a class="item" href="{{.RepoLink}}/_upload/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}"> |
69 | | - {{ctx.Locale.Tr "repo.editor.upload_file"}} |
70 | | - </a> |
71 | | - {{end}} |
72 | | - <a class="item" href="{{.RepoLink}}/_diffpatch/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}"> |
73 | | - {{ctx.Locale.Tr "repo.editor.patch"}} |
74 | | - </a> |
75 | | - </div> |
76 | | - </button> |
77 | | - {{end}} |
78 | | - |
79 | | - {{if and $isTreePathRoot .Repository.IsTemplate}} |
80 | | - <a role="button" class="ui primary compact button" href="{{AppSubUrl}}/repo/create?template_id={{.Repository.ID}}"> |
81 | | - {{ctx.Locale.Tr "repo.use_template"}} |
82 | | - </a> |
83 | | - {{end}} |
84 | | - |
85 | | - {{if not $isTreePathRoot}} |
86 | | - {{$treeNameIdxLast := Eval $treeNamesLen "-" 1}} |
87 | | - <span id="repo_path" class="breadcrumb repo-path tw-ml-1"> |
88 | | - <a class="section" href="{{.RepoLink}}/src/{{.BranchNameSubURL}}" title="{{.Repository.Name}}">{{StringUtils.EllipsisString .Repository.Name 30}}</a> |
89 | | - {{- range $i, $v := .TreeNames -}} |
90 | | - <span class="breadcrumb-divider">/</span> |
91 | | - {{- if eq $i $treeNameIdxLast -}} |
92 | | - <span class="active section" title="{{$v}}">{{$v}}</span> |
93 | | - <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 | | - {{- else -}} |
95 | | - {{$p := index $.Paths $i}}<span class="section"><a href="{{$.BranchLink}}/{{PathEscapeSegments $p}}" title="{{$v}}">{{$v}}</a></span> |
96 | | - {{- end -}} |
97 | | - {{- end -}} |
98 | | - </span> |
99 | | - {{end}} |
100 | | - </div> |
101 | | - |
102 | | - <div class="repo-button-row-right"> |
103 | | - <!-- Only show clone panel in repository home page --> |
104 | | - {{if $isTreePathRoot}} |
105 | | - {{template "repo/clone_panel" .}} |
106 | | - {{end}} |
107 | | - {{if and (not $isTreePathRoot) (not .IsViewFile) (not .IsBlame)}}{{/* IsViewDirectory (not home), TODO: split the templates, avoid using "if" tricks */}} |
108 | | - <a id="path_history" class="ui button" href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}/{{.TreePath | PathEscapeSegments}}"> |
109 | | - {{svg "octicon-history" 16 "tw-mr-2"}}{{ctx.Locale.Tr "repo.file_history"}} |
110 | | - </a> |
111 | | - {{end}} |
112 | | - </div> |
113 | | - </div> |
114 | | - |
115 | | - <div id="path_content"> |
116 | | - {{template "repo/home_content" .}} |
117 | | - </div> |
| 31 | + {{template "repo/home_content" .}} |
118 | 32 | </div> |
119 | 33 |
|
120 | 34 | {{if $showSidebar}} |
|
0 commit comments