mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Simplify context ref name (#33267)
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
<div class="file-header-right file-actions tw-flex tw-items-center tw-flex-wrap">
|
||||
<div class="ui buttons">
|
||||
<a class="ui tiny button" href="{{$.RawFileLink}}">{{ctx.Locale.Tr "repo.file_raw"}}</a>
|
||||
{{if not .IsViewCommit}}
|
||||
{{if or .RefFullName.IsBranch .RefFullName.IsTag}}
|
||||
<a class="ui tiny button" href="{{.RepoLink}}/src/commit/{{.CommitID | PathEscape}}/{{.TreePath | PathEscapeSegments}}">{{ctx.Locale.Tr "repo.file_permalink"}}</a>
|
||||
{{end}}
|
||||
<a class="ui tiny button" href="{{.RepoLink}}/src/{{.RefTypeNameSubURL}}/{{.TreePath | PathEscapeSegments}}">{{ctx.Locale.Tr "repo.normal_view"}}</a>
|
||||
|
@@ -54,13 +54,11 @@
|
||||
<p id="cherry-pick-content" class="branch-dropdown"></p>
|
||||
|
||||
<form method="get">
|
||||
{{/*FIXME: CurrentRefShortName seems not making sense here (old code),
|
||||
because the "commit page" has no "$.BranchName" info, so only using DefaultBranch should be enough */}}
|
||||
{{template "repo/branch_dropdown" dict
|
||||
"Repository" .Repository
|
||||
"ShowTabBranches" true
|
||||
"CurrentRefType" "branch"
|
||||
"CurrentRefShortName" (or $.BranchName $.Repository.DefaultBranch)
|
||||
"CurrentRefShortName" $.Repository.DefaultBranch
|
||||
"RefFormActionTemplate" (print "{RepoLink}/_cherrypick/" .CommitID "/{RefShortName}")
|
||||
}}
|
||||
<input type="hidden" id="cherry-pick-type" name="cherry-pick-type"><br>
|
||||
|
@@ -5,24 +5,13 @@
|
||||
{{template "repo/sub_menu" .}}
|
||||
<div class="repo-button-row">
|
||||
<div class="repo-button-row-left">
|
||||
{{- /* for /owner/repo/commits/branch/the-name */ -}}
|
||||
{{- $branchDropdownCurrentRefType := "branch" -}}
|
||||
{{- $branchDropdownCurrentRefShortName := .BranchName -}}
|
||||
{{- if .IsViewTag -}}
|
||||
{{- /* for /owner/repo/commits/tag/the-name */ -}}
|
||||
{{- $branchDropdownCurrentRefType = "tag" -}}
|
||||
{{- $branchDropdownCurrentRefShortName = .TagName -}}
|
||||
{{- else if .IsViewCommit -}}
|
||||
{{- /* for /owner/repo/commits/commit/000000 */ -}}
|
||||
{{- $branchDropdownCurrentRefType = "commit" -}}
|
||||
{{- $branchDropdownCurrentRefShortName = ShortSha .CommitID -}}
|
||||
{{- end -}}
|
||||
{{- /* for /owner/repo/commits/{RefType}/{RefShortName} */ -}}
|
||||
{{- template "repo/branch_dropdown" dict
|
||||
"Repository" .Repository
|
||||
"ShowTabBranches" true
|
||||
"ShowTabTags" true
|
||||
"CurrentRefType" $branchDropdownCurrentRefType
|
||||
"CurrentRefShortName" $branchDropdownCurrentRefShortName
|
||||
"CurrentRefType" .RefFullName.RefType
|
||||
"CurrentRefShortName" .RefFullName.ShortName
|
||||
"CurrentTreePath" .TreePath
|
||||
"RefLinkTemplate" "{RepoLink}/commits/{RefType}/{RefShortName}/{TreePath}"
|
||||
"AllowCreateNewRef" .CanCreateBranch
|
||||
|
@@ -24,30 +24,19 @@
|
||||
{{template "repo/sub_menu" .}}
|
||||
<div class="repo-button-row">
|
||||
<div class="repo-button-row-left">
|
||||
{{- /* for repo home (default branch) and /owner/repo/src/branch/the-name */ -}}
|
||||
{{- $branchDropdownCurrentRefType := "branch" -}}
|
||||
{{- $branchDropdownCurrentRefShortName := .BranchName -}}
|
||||
{{- if .IsViewTag -}}
|
||||
{{- /* for /owner/repo/src/tag/the-name */ -}}
|
||||
{{- $branchDropdownCurrentRefType = "tag" -}}
|
||||
{{- $branchDropdownCurrentRefShortName = .TagName -}}
|
||||
{{- else if .IsViewCommit -}}
|
||||
{{- /* for /owner/repo/src/commit/000000 */ -}}
|
||||
{{- $branchDropdownCurrentRefType = "commit" -}}
|
||||
{{- $branchDropdownCurrentRefShortName = ShortSha .CommitID -}}
|
||||
{{- end -}}
|
||||
{{- /* for repo home (default branch) and /owner/repo/src/{RefType}/{RefShortName} */ -}}
|
||||
{{- template "repo/branch_dropdown" dict
|
||||
"Repository" .Repository
|
||||
"ShowTabBranches" true
|
||||
"ShowTabTags" true
|
||||
"CurrentRefType" $branchDropdownCurrentRefType
|
||||
"CurrentRefShortName" $branchDropdownCurrentRefShortName
|
||||
"CurrentRefType" .RefFullName.RefType
|
||||
"CurrentRefShortName" .RefFullName.ShortName
|
||||
"CurrentTreePath" .TreePath
|
||||
"RefLinkTemplate" "{RepoLink}/src/{RefType}/{RefShortName}/{TreePath}"
|
||||
"AllowCreateNewRef" .CanCreateBranch
|
||||
"ShowViewAllRefsEntry" true
|
||||
-}}
|
||||
{{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}}
|
||||
{{if and .CanCompareOrPull .RefFullName.IsBranch (not .Repository.IsArchived)}}
|
||||
{{$cmpBranch := ""}}
|
||||
{{if ne .Repository.ID .BaseRepo.ID}}
|
||||
{{$cmpBranch = printf "%s/%s:" (.Repository.OwnerName|PathEscape) (.Repository.Name|PathEscape)}}
|
||||
@@ -65,7 +54,7 @@
|
||||
<a href="{{.Repository.Link}}/find/{{.RefTypeNameSubURL}}" class="ui compact basic button">{{ctx.Locale.Tr "repo.find_file.go_to_file"}}</a>
|
||||
{{end}}
|
||||
|
||||
{{if and .CanWriteCode .IsViewBranch (not .Repository.IsMirror) (not .Repository.IsArchived) (not .IsViewFile)}}
|
||||
{{if and .CanWriteCode .RefFullName.IsBranch (not .Repository.IsMirror) (not .Repository.IsArchived) (not .IsViewFile)}}
|
||||
<button class="ui dropdown basic compact jump button"{{if not .Repository.CanEnableEditor}} disabled{{end}}>
|
||||
{{ctx.Locale.Tr "repo.editor.add_file"}}
|
||||
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
||||
|
@@ -24,7 +24,7 @@
|
||||
"Repository" $.Repository
|
||||
"ShowTabTags" true
|
||||
"DropdownFixedText" (ctx.Locale.Tr "repo.release.compare")
|
||||
"RefLinkTemplate" (print "{RepoLink}/compare/{RefShortName}..." (PathEscapeSegments $compareTarget))
|
||||
"RefLinkTemplate" (print "{RepoLink}/compare/{RefShortName}" "..." (PathEscapeSegments $compareTarget))
|
||||
}}
|
||||
{{end}}
|
||||
</div>
|
||||
|
@@ -42,7 +42,7 @@
|
||||
{{if not .ReadmeInList}}
|
||||
<div class="ui buttons tw-mr-1">
|
||||
<a class="ui mini basic button" href="{{$.RawFileLink}}">{{ctx.Locale.Tr "repo.file_raw"}}</a>
|
||||
{{if not .IsViewCommit}}
|
||||
{{if or .RefFullName.IsBranch .RefFullName.IsTag}}
|
||||
<a class="ui mini basic button" href="{{.RepoLink}}/src/commit/{{PathEscape .CommitID}}/{{PathEscapeSegments .TreePath}}">{{ctx.Locale.Tr "repo.file_permalink"}}</a>
|
||||
{{end}}
|
||||
{{if .IsRepresentableAsText}}
|
||||
|
Reference in New Issue
Block a user