@ -60,55 +60,49 @@
</div>
</div>
{{ end }}
{{ end }}
{{ template "repo/sub_menu" . }}
{{ template "repo/sub_menu" . }}
<div class="ui stackable secondary menu mobile--margin-between-items mobile--no-negative-margins no-vertical-tabs ">
<div class="repo-button-row df ac sb fw ">
{{ template "repo/branch_dropdown" dict "root" . }}
<div class="df ac">
{{ $ n : = len .TreeNames }}
{{ template "repo/branch_dropdown" dict "root" . }}
{{ $ l : = Subtract $ n 1 }}
{{ $ n : = len .TreeNames }}
<!-- If home page, show new PR. If not, show breadcrumb -->
{{ $ l : = Subtract $ n 1 }}
{{ if eq $ n 0 }}
<!-- If home page, show new PR. If not, show breadcrumb -->
{{ if and .CanCompareOrPull .IsViewBranch ( not .Repository .IsArchived ) }}
{{ if eq $ n 0 }}
<div class="fitted item mx-0">
{{ if and .CanCompareOrPull .IsViewBranch ( not .Repository .IsArchived ) }}
<a href=" {{ .BaseRepo .Link }} /compare/ {{ PathEscapeSegments .BaseRepo .DefaultBranch }} ... {{ if ne .Repository .Owner .Name .BaseRepo .Owner .Name }} {{ PathEscape .Repository .Owner .Name }} {{ if .BaseRepo .IsFork }} / {{ PathEscape .Repository .Name }} {{ end }} : {{ end }} {{ PathEscapeSegments .BranchName }} ">
<a href=" {{ .BaseRepo .Link }} /compare/ {{ PathEscapeSegments .BaseRepo .DefaultBranch }} ... {{ if ne .Repository .Owner .Name .BaseRepo .Owner .Name }} {{ PathEscape .Repository .Owner .Name }} {{ if .BaseRepo .IsFork }} / {{ PathEscape .Repository .Name }} {{ end }} : {{ end }} {{ PathEscapeSegments .BranchName }} ">
<button id="new-pull-request" class="ui compact basic button"> {{ if .PullRequestCtx .Allowed }} {{ .i18n .Tr "repo.pulls.compare_changes" }} {{ else }} {{ .i18n .Tr "action.compare_branch" }} {{ end }} </button>
<button id="new-pull-request" class="ui compact basic button tooltip" data-content=" {{ if .PullRequestCtx .Allowed }} {{ .i18n .Tr "repo.pulls.compare_changes" }} {{ else }} {{ .i18n .Tr "action.compare_branch" }} {{ end }} "><span class="text"> {{ svg "octicon-git-pull-request" }} </span> </button>
</a>
</a>
</div>
{{ end }}
<div class="fitted item mx-0">
<a href=" {{ .Repository .Link }} /find/ {{ .BranchNameSubURL }} " class="ui compact basic button">
{{ .i18n .Tr "repo.find_file.go_to_file" }}
</a>
</div>
{{ else }}
<div class="fitted item"><span class="ui breadcrumb repo-path"><a class="section" href=" {{ .RepoLink }} /src/ {{ .BranchNameSubURL }} " title=" {{ .Repository .Name }} "> {{ EllipsisString .Repository .Name 3 0 }} </a> {{ range $ i , $ v : = .TreeNames }} <span class="divider">/</span> {{ if eq $ i $ l }} <span class="active section" title=" {{ $ v }} "> {{ EllipsisString $ v 3 0 }} </span> {{ else }} {{ $ p : = in dex $ .Paths $ i }} <span class="section"><a href=" {{ $ .BranchLink }} / {{ PathEscapeSegments $ p }} " title=" {{ $ v }} "> {{ EllipsisString $ v 3 0 }} </a></span> {{ end }} {{ end }} </span></div>
{{ end }}
<div class="right fitted item mr-0" id="file-buttons">
<div class="ui tiny primary buttons">
{{ if .Repository .CanEnableEditor }}
{{ if .CanAddFile }}
<a href=" {{ .RepoLink }} /_new/ {{ .BranchName | PathEscapeSegments }} / {{ .TreePath | PathEscapeSegments }} " class="ui button">
{{ .i18n .Tr "repo.editor.new_file" }}
</a>
{{ end }}
{{ if .CanUploadFile }}
<a href=" {{ .RepoLink }} /_upload/ {{ .BranchName | PathEscapeSegments }} / {{ .TreePath | PathEscapeSegments }} " class="ui button">
{{ .i18n .Tr "repo.editor.upload_file" }}
</a>
{{ end }}
{{ if .CanAddFile }}
<a href=" {{ .RepoLink }} /_diffpatch/ {{ .BranchName | PathEscapeSegments }} / {{ .TreePath | PathEscapeSegments }} " class="ui button">
{{ .i18n .Tr "repo.editor.patch" }}
</a>
{{ end }}
{{ end }}
{{ end }}
{{ if and ( ne $ n 0 ) ( not .IsViewFile ) ( not .IsBlame ) }}
<a href=" {{ .Repository .Link }} /find/ {{ .BranchNameSubURL }} " class="ui compact basic button tooltip" data-content=" {{ .i18n .Tr "repo.find_file.go_to_file" }} "> {{ svg "octicon-file-moved" 1 5 }} </a>
<a href=" {{ .RepoLink }} /commits/ {{ .BranchNameSubURL }} / {{ .TreePath | PathEscapeSegments }} " class="ui button">
{{ if or .CanAddFile .CanUploadFile }}
{{ .i18n .Tr "repo.file_history" }}
<button class="ui basic small compact dropdown jump icon button mr-2">
</a>
<span class="text"> {{ .i18n .Tr "repo.editor.add_file" }} </span>
<div class="menu">
{{ if .Repository .CanEnableEditor }}
{{ if .CanAddFile }}
<a class="item" href=" {{ .RepoLink }} /_new/ {{ .BranchName | PathEscapeSegments }} / {{ .TreePath | PathEscapeSegments }} ">
{{ .i18n .Tr "repo.editor.new_file" }}
</a>
{{ end }}
{{ if .CanUploadFile }}
<a class="item" href=" {{ .RepoLink }} /_upload/ {{ .BranchName | PathEscapeSegments }} / {{ .TreePath | PathEscapeSegments }} ">
{{ .i18n .Tr "repo.editor.upload_file" }}
</a>
{{ end }}
{{ if .CanAddFile }}
<a class="item" href=" {{ .RepoLink }} /_diffpatch/ {{ .BranchName | PathEscapeSegments }} / {{ .TreePath | PathEscapeSegments }} ">
{{ .i18n .Tr "repo.editor.patch" }}
</a>
{{ end }}
{{ end }}
</div>
{{ svg "octicon-triangle-down" 1 4 "dropdown icon" }}
</button>
{{ end }}
{{ end }}
</div>
{{ else }}
<span class="ui breadcrumb repo-path"><a class="section" href=" {{ .RepoLink }} /src/ {{ .BranchNameSubURL }} " title=" {{ .Repository .Name }} "> {{ EllipsisString .Repository .Name 3 0 }} </a> {{ range $ i , $ v : = .TreeNames }} <span class="divider">/</span> {{ if eq $ i $ l }} <span class="active section" title=" {{ $ v }} "> {{ EllipsisString $ v 3 0 }} </span> {{ else }} {{ $ p : = in dex $ .Paths $ i }} <span class="section"><a href=" {{ $ .BranchLink }} / {{ PathEscapeSegments $ p }} " title=" {{ $ v }} "> {{ EllipsisString $ v 3 0 }} </a></span> {{ end }} {{ end }} </span>
{{ end }}
</div>
</div>
<div class="fitted item">
<div class="df ac ">
{{ if eq $ n 0 }}
{{ if eq $ n 0 }}
{{ if .Repository .IsTemplate }}
{{ if .Repository .IsTemplate }}
<div class="ui tiny primary buttons">
<div class="ui tiny primary buttons">
@ -118,14 +112,13 @@
</div>
</div>
{{ end }}
{{ end }}
{{ end }}
{{ end }}
</div>
<div class="fitted item">
<!-- Only show clone panel in repository home page -->
<!-- Only show clone panel in repository home page -->
{{ if eq $ n 0 }}
{{ if eq $ n 0 }}
<div class="ui action tiny input" id="clone-panel">
<div class="ui action tiny input" id="clone-panel">
{{ template "repo/clone_buttons" . }}
{{ template "repo/clone_buttons" . }}
{{ template "repo/clone_script" . }}
{{ template "repo/clone_script" . }}
<button id="download-btn" class="ui basic jump dropdown icon button tooltip" data-content=" {{ .i18n .Tr "repo.download_archive" }} " data-position="top right">
{{ if not .DisableDownloadSourceArchives }}
<button id="download-btn" class="ui basic small compact jump dropdown icon button tooltip" data-content=" {{ .i18n .Tr "repo.download_archive" }} " data-position="top right">
{{ svg "octicon-download" }}
{{ svg "octicon-download" }}
<div class="menu">
<div class="menu">
{{ if not $ .DisableDownloadSourceArchives }}
{{ if not $ .DisableDownloadSourceArchives }}
@ -136,8 +129,14 @@
<a class="item" href="vscode://vscode.git/clone?url= {{ $ .RepoCloneLink .HTTPS }} "> {{ svg "gitea-vscode" 1 6 "mr-3" }} {{ .i18n .Tr "repo.clone_in_vsc" }} </a>
<a class="item" href="vscode://vscode.git/clone?url= {{ $ .RepoCloneLink .HTTPS }} "> {{ svg "gitea-vscode" 1 6 "mr-3" }} {{ .i18n .Tr "repo.clone_in_vsc" }} </a>
</div>
</div>
</button>
</button>
{{ end }}
</div>
</div>
{{ end }}
{{ end }}
{{ if and ( ne $ n 0 ) ( not .IsViewFile ) ( not .IsBlame ) }}
<a class="ui button" href=" {{ .RepoLink }} /commits/ {{ .BranchNameSubURL }} / {{ .TreePath | PathEscapeSegments }} ">
{{ svg "octicon-history" 1 6 "mr-3" }} {{ .i18n .Tr "repo.file_history" }}
</a>
{{ end }}
</div>
</div>
</div>
</div>
{{ if .IsViewFile }}
{{ if .IsViewFile }}