1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-12-22 17:34:03 +03:00

Add "View all branches/tags" entry to Branch Selector (#32653)

![image](https://github.com/user-attachments/assets/7b62a38f-36d5-452a-8a97-204842c68b2e)

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Kerwin Bryant 2024-12-03 04:19:27 +08:00 committed by GitHub
parent 13fbab5cf4
commit 576e31ae3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 0 deletions

View File

@ -1032,6 +1032,8 @@ fork_to_different_account = Fork to a different account
fork_visibility_helper = The visibility of a forked repository cannot be changed. fork_visibility_helper = The visibility of a forked repository cannot be changed.
fork_branch = Branch to be cloned to the fork fork_branch = Branch to be cloned to the fork
all_branches = All branches all_branches = All branches
view_all_branches = View all branches
view_all_tags = View all tags
fork_no_valid_owners = This repository can not be forked because there are no valid owners. fork_no_valid_owners = This repository can not be forked because there are no valid owners.
fork.blocked_user = Cannot fork the repository because you are blocked by the repository owner. fork.blocked_user = Cannot fork the repository because you are blocked by the repository owner.
use_template = Use this template use_template = Use this template

View File

@ -10,6 +10,7 @@
* ShowTabBranches * ShowTabBranches
* ShowTabTagsTab * ShowTabTagsTab
* AllowCreateNewRef * AllowCreateNewRef
* ShowViewAllRefsEntry
Search "repo/branch_dropdown" in the template directory to find all occurrences. Search "repo/branch_dropdown" in the template directory to find all occurrences.
*/}} */}}
@ -24,6 +25,8 @@ Search "repo/branch_dropdown" in the template directory to find all occurrences.
data-text-create-branch="{{ctx.Locale.Tr "repo.branch.create_branch"}}" data-text-create-branch="{{ctx.Locale.Tr "repo.branch.create_branch"}}"
data-text-create-ref-from="{{ctx.Locale.Tr "repo.branch.create_from"}}" data-text-create-ref-from="{{ctx.Locale.Tr "repo.branch.create_from"}}"
data-text-no-results="{{ctx.Locale.Tr "no_results_found"}}" data-text-no-results="{{ctx.Locale.Tr "no_results_found"}}"
data-text-view-all-branches="{{ctx.Locale.Tr "repo.view_all_branches"}}"
data-text-view-all-tags="{{ctx.Locale.Tr "repo.view_all_tags"}}"
data-current-repo-default-branch="{{.Repository.DefaultBranch}}" data-current-repo-default-branch="{{.Repository.DefaultBranch}}"
data-current-repo-link="{{.Repository.Link}}" data-current-repo-link="{{.Repository.Link}}"
@ -37,6 +40,7 @@ Search "repo/branch_dropdown" in the template directory to find all occurrences.
data-show-tab-branches="{{.ShowTabBranches}}" data-show-tab-branches="{{.ShowTabBranches}}"
data-show-tab-tags="{{.ShowTabTags}}" data-show-tab-tags="{{.ShowTabTags}}"
data-allow-create-new-ref="{{.AllowCreateNewRef}}" data-allow-create-new-ref="{{.AllowCreateNewRef}}"
data-show-view-all-refs-entry="{{.ShowViewAllRefsEntry}}"
data-enable-feed="{{ctx.RootData.EnableFeed}}" data-enable-feed="{{ctx.RootData.EnableFeed}}"
> >

View File

@ -62,6 +62,7 @@
"CurrentTreePath" .TreePath "CurrentTreePath" .TreePath
"RefLinkTemplate" "{RepoLink}/src/{RefType}/{RefShortName}/{TreePath}" "RefLinkTemplate" "{RepoLink}/src/{RefType}/{RefShortName}/{TreePath}"
"AllowCreateNewRef" .CanCreateBranch "AllowCreateNewRef" .CanCreateBranch
"ShowViewAllRefsEntry" true
}} }}
{{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}} {{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}}
{{$cmpBranch := ""}} {{$cmpBranch := ""}}

View File

@ -86,6 +86,8 @@ const sfc = {
textCreateBranch: elRoot.getAttribute('data-text-create-branch'), textCreateBranch: elRoot.getAttribute('data-text-create-branch'),
textCreateRefFrom: elRoot.getAttribute('data-text-create-ref-from'), textCreateRefFrom: elRoot.getAttribute('data-text-create-ref-from'),
textNoResults: elRoot.getAttribute('data-text-no-results'), textNoResults: elRoot.getAttribute('data-text-no-results'),
textViewAllBranches: elRoot.getAttribute('data-text-view-all-branches'),
textViewAllTags: elRoot.getAttribute('data-text-view-all-tags'),
currentRepoDefaultBranch: elRoot.getAttribute('data-current-repo-default-branch'), currentRepoDefaultBranch: elRoot.getAttribute('data-current-repo-default-branch'),
currentRepoLink: elRoot.getAttribute('data-current-repo-link'), currentRepoLink: elRoot.getAttribute('data-current-repo-link'),
@ -99,6 +101,7 @@ const sfc = {
showTabBranches: shouldShowTabBranches, showTabBranches: shouldShowTabBranches,
showTabTags: elRoot.getAttribute('data-show-tab-tags') === 'true', showTabTags: elRoot.getAttribute('data-show-tab-tags') === 'true',
allowCreateNewRef: elRoot.getAttribute('data-allow-create-new-ref') === 'true', allowCreateNewRef: elRoot.getAttribute('data-allow-create-new-ref') === 'true',
showViewAllRefsEntry: elRoot.getAttribute('data-show-view-all-refs-entry') === 'true',
enableFeed: elRoot.getAttribute('data-enable-feed') === 'true', enableFeed: elRoot.getAttribute('data-enable-feed') === 'true',
}; };
@ -281,6 +284,11 @@ export default sfc; // activate IDE's Vue plugin
<div class="message" v-if="showNoResults"> <div class="message" v-if="showNoResults">
{{ textNoResults }} {{ textNoResults }}
</div> </div>
<template v-if="showViewAllRefsEntry">
<div class="divider tw-m-0"/>
<a v-if="selectedTab === 'branches'" class="item" :href="currentRepoLink + '/branches'">{{ textViewAllBranches }}</a>
<a v-if="selectedTab === 'tags'" class="item" :href="currentRepoLink + '/tags'">{{ textViewAllTags }}</a>
</template>
</div> </div>
</div> </div>
</template> </template>