|
| 1 | +<div class="view-file-tree-sidebar-top"> |
| 2 | + <div class="sidebar-header"> |
| 3 | + <button class="hide-tree-sidebar-button ui compact basic button icon" title="{{ctx.Locale.Tr "repo.diff.hide_file_tree"}}"> |
| 4 | + {{svg "octicon-sidebar-expand" 20 "icon"}} |
| 5 | + </button> |
| 6 | + <b> Files</b> |
| 7 | + </div> |
| 8 | + <div class="sidebar-ref"> |
| 9 | + {{$branchDropdownCurrentRefType := "branch"}} |
| 10 | + {{$branchDropdownCurrentRefShortName := .BranchName}} |
| 11 | + {{if .IsViewTag}} |
| 12 | + {{$branchDropdownCurrentRefType = "tag"}} |
| 13 | + {{$branchDropdownCurrentRefShortName = .TagName}} |
| 14 | + {{end}} |
| 15 | + {{template "repo/branch_dropdown" dict |
| 16 | + "Repository" .Repository |
| 17 | + "ShowTabBranches" true |
| 18 | + "ShowTabTags" true |
| 19 | + "CurrentRefType" $branchDropdownCurrentRefType |
| 20 | + "CurrentRefShortName" $branchDropdownCurrentRefShortName |
| 21 | + "CurrentTreePath" .TreePath |
| 22 | + "RefLinkTemplate" "{RepoLink}/src/{RefType}/{RefShortName}/{TreePath}" |
| 23 | + "AllowCreateNewRef" .CanCreateBranch |
| 24 | + "ShowViewAllRefsEntry" true |
| 25 | + }} |
| 26 | + |
| 27 | + {{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}} |
| 28 | + {{$cmpBranch := ""}} |
| 29 | + {{if ne .Repository.ID .BaseRepo.ID}} |
| 30 | + {{$cmpBranch = printf "%s/%s:" (.Repository.OwnerName|PathEscape) (.Repository.Name|PathEscape)}} |
| 31 | + {{end}} |
| 32 | + {{$cmpBranch = print $cmpBranch (.BranchName|PathEscapeSegments)}} |
| 33 | + {{$compareLink := printf "%s/compare/%s...%s" .BaseRepo.Link (.BaseRepo.DefaultBranch|PathEscapeSegments) $cmpBranch}} |
| 34 | + <a role="button" class="ui compact basic button" href="{{$compareLink}}" |
| 35 | + data-tooltip-content="{{if .PullRequestCtx.Allowed}}{{ctx.Locale.Tr "repo.pulls.compare_changes"}}{{else}}{{ctx.Locale.Tr "action.compare_branch"}}{{end}}"> |
| 36 | + {{svg "octicon-git-pull-request"}} |
| 37 | + </a> |
| 38 | + {{end}} |
| 39 | + |
| 40 | + {{if and .CanWriteCode .IsViewBranch (not .Repository.IsMirror) (not .Repository.IsArchived) (not .IsViewFile)}} |
| 41 | + <button class="ui dropdown basic compact jump button"{{if not .Repository.CanEnableEditor}} disabled{{end}}> |
| 42 | + {{ctx.Locale.Tr "repo.editor.add_file"}} |
| 43 | + {{svg "octicon-triangle-down" 14 "dropdown icon"}} |
| 44 | + <div class="menu"> |
| 45 | + <a class="item" href="{{.RepoLink}}/_new/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}"> |
| 46 | + {{ctx.Locale.Tr "repo.editor.new_file"}} |
| 47 | + </a> |
| 48 | + {{if .RepositoryUploadEnabled}} |
| 49 | + <a class="item" href="{{.RepoLink}}/_upload/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}"> |
| 50 | + {{ctx.Locale.Tr "repo.editor.upload_file"}} |
| 51 | + </a> |
| 52 | + {{end}} |
| 53 | + <a class="item" href="{{.RepoLink}}/_diffpatch/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}"> |
| 54 | + {{ctx.Locale.Tr "repo.editor.patch"}} |
| 55 | + </a> |
| 56 | + </div> |
| 57 | + </button> |
| 58 | + {{end}} |
| 59 | + </div> |
| 60 | +</div> |
| 61 | +<div class="view-file-tree-sidebar-bottom"> |
| 62 | + <div id="view-file-tree" class="center" data-api-base-url="{{.RepoLink}}" data-tree-path="{{$.TreePath}}"> |
| 63 | + {{svg "octicon-sync" 16 "job-status-rotate"}} |
| 64 | + </div> |
| 65 | +</div> |
0 commit comments