Skip to content

Commit 576e31a

Browse files
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 <[email protected]>
1 parent 13fbab5 commit 576e31a

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

options/locale/locale_en-US.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,8 @@ fork_to_different_account = Fork to a different account
10321032
fork_visibility_helper = The visibility of a forked repository cannot be changed.
10331033
fork_branch = Branch to be cloned to the fork
10341034
all_branches = All branches
1035+
view_all_branches = View all branches
1036+
view_all_tags = View all tags
10351037
fork_no_valid_owners = This repository can not be forked because there are no valid owners.
10361038
fork.blocked_user = Cannot fork the repository because you are blocked by the repository owner.
10371039
use_template = Use this template

templates/repo/branch_dropdown.tmpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* ShowTabBranches
1111
* ShowTabTagsTab
1212
* AllowCreateNewRef
13+
* ShowViewAllRefsEntry
1314

1415
Search "repo/branch_dropdown" in the template directory to find all occurrences.
1516
*/}}
@@ -24,6 +25,8 @@ Search "repo/branch_dropdown" in the template directory to find all occurrences.
2425
data-text-create-branch="{{ctx.Locale.Tr "repo.branch.create_branch"}}"
2526
data-text-create-ref-from="{{ctx.Locale.Tr "repo.branch.create_from"}}"
2627
data-text-no-results="{{ctx.Locale.Tr "no_results_found"}}"
28+
data-text-view-all-branches="{{ctx.Locale.Tr "repo.view_all_branches"}}"
29+
data-text-view-all-tags="{{ctx.Locale.Tr "repo.view_all_tags"}}"
2730

2831
data-current-repo-default-branch="{{.Repository.DefaultBranch}}"
2932
data-current-repo-link="{{.Repository.Link}}"
@@ -37,6 +40,7 @@ Search "repo/branch_dropdown" in the template directory to find all occurrences.
3740
data-show-tab-branches="{{.ShowTabBranches}}"
3841
data-show-tab-tags="{{.ShowTabTags}}"
3942
data-allow-create-new-ref="{{.AllowCreateNewRef}}"
43+
data-show-view-all-refs-entry="{{.ShowViewAllRefsEntry}}"
4044

4145
data-enable-feed="{{ctx.RootData.EnableFeed}}"
4246
>

templates/repo/home.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
"CurrentTreePath" .TreePath
6363
"RefLinkTemplate" "{RepoLink}/src/{RefType}/{RefShortName}/{TreePath}"
6464
"AllowCreateNewRef" .CanCreateBranch
65+
"ShowViewAllRefsEntry" true
6566
}}
6667
{{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}}
6768
{{$cmpBranch := ""}}

web_src/js/components/RepoBranchTagSelector.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ const sfc = {
8686
textCreateBranch: elRoot.getAttribute('data-text-create-branch'),
8787
textCreateRefFrom: elRoot.getAttribute('data-text-create-ref-from'),
8888
textNoResults: elRoot.getAttribute('data-text-no-results'),
89+
textViewAllBranches: elRoot.getAttribute('data-text-view-all-branches'),
90+
textViewAllTags: elRoot.getAttribute('data-text-view-all-tags'),
8991
9092
currentRepoDefaultBranch: elRoot.getAttribute('data-current-repo-default-branch'),
9193
currentRepoLink: elRoot.getAttribute('data-current-repo-link'),
@@ -99,6 +101,7 @@ const sfc = {
99101
showTabBranches: shouldShowTabBranches,
100102
showTabTags: elRoot.getAttribute('data-show-tab-tags') === 'true',
101103
allowCreateNewRef: elRoot.getAttribute('data-allow-create-new-ref') === 'true',
104+
showViewAllRefsEntry: elRoot.getAttribute('data-show-view-all-refs-entry') === 'true',
102105
103106
enableFeed: elRoot.getAttribute('data-enable-feed') === 'true',
104107
};
@@ -281,6 +284,11 @@ export default sfc; // activate IDE's Vue plugin
281284
<div class="message" v-if="showNoResults">
282285
{{ textNoResults }}
283286
</div>
287+
<template v-if="showViewAllRefsEntry">
288+
<div class="divider tw-m-0"/>
289+
<a v-if="selectedTab === 'branches'" class="item" :href="currentRepoLink + '/branches'">{{ textViewAllBranches }}</a>
290+
<a v-if="selectedTab === 'tags'" class="item" :href="currentRepoLink + '/tags'">{{ textViewAllTags }}</a>
291+
</template>
284292
</div>
285293
</div>
286294
</template>

0 commit comments

Comments
 (0)