aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKerwin Bryant <kerwin612@qq.com>2024-12-03 04:19:27 +0800
committerGitHub <noreply@github.com>2024-12-02 20:19:27 +0000
commit576e31ae3b6cab27865c8b1ad5a3b2cc3f857cf6 (patch)
tree5d3e41de3ac06866f85b7937b03c0caf1dd6d02e
parent13fbab5cf45c7546a976f0a802bbe2ddcb018f7c (diff)
downloadgitea-576e31ae3b6cab27865c8b1ad5a3b2cc3f857cf6.tar.gz
gitea-576e31ae3b6cab27865c8b1ad5a3b2cc3f857cf6.zip
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>
-rw-r--r--options/locale/locale_en-US.ini2
-rw-r--r--templates/repo/branch_dropdown.tmpl4
-rw-r--r--templates/repo/home.tmpl1
-rw-r--r--web_src/js/components/RepoBranchTagSelector.vue8
4 files changed, 15 insertions, 0 deletions
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index 1dc0c3cb81..8da7412ade 100644
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -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_branch = Branch to be cloned to the fork
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.blocked_user = Cannot fork the repository because you are blocked by the repository owner.
use_template = Use this template
diff --git a/templates/repo/branch_dropdown.tmpl b/templates/repo/branch_dropdown.tmpl
index 43568732fb..b68c34a02a 100644
--- a/templates/repo/branch_dropdown.tmpl
+++ b/templates/repo/branch_dropdown.tmpl
@@ -10,6 +10,7 @@
* ShowTabBranches
* ShowTabTagsTab
* AllowCreateNewRef
+* ShowViewAllRefsEntry
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-ref-from="{{ctx.Locale.Tr "repo.branch.create_from"}}"
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-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-tags="{{.ShowTabTags}}"
data-allow-create-new-ref="{{.AllowCreateNewRef}}"
+ data-show-view-all-refs-entry="{{.ShowViewAllRefsEntry}}"
data-enable-feed="{{ctx.RootData.EnableFeed}}"
>
diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl
index 1e77cd4919..4b25915c27 100644
--- a/templates/repo/home.tmpl
+++ b/templates/repo/home.tmpl
@@ -62,6 +62,7 @@
"CurrentTreePath" .TreePath
"RefLinkTemplate" "{RepoLink}/src/{RefType}/{RefShortName}/{TreePath}"
"AllowCreateNewRef" .CanCreateBranch
+ "ShowViewAllRefsEntry" true
}}
{{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}}
{{$cmpBranch := ""}}
diff --git a/web_src/js/components/RepoBranchTagSelector.vue b/web_src/js/components/RepoBranchTagSelector.vue
index 05f7b59a66..2f66336a66 100644
--- a/web_src/js/components/RepoBranchTagSelector.vue
+++ b/web_src/js/components/RepoBranchTagSelector.vue
@@ -86,6 +86,8 @@ const sfc = {
textCreateBranch: elRoot.getAttribute('data-text-create-branch'),
textCreateRefFrom: elRoot.getAttribute('data-text-create-ref-from'),
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'),
currentRepoLink: elRoot.getAttribute('data-current-repo-link'),
@@ -99,6 +101,7 @@ const sfc = {
showTabBranches: shouldShowTabBranches,
showTabTags: elRoot.getAttribute('data-show-tab-tags') === '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',
};
@@ -281,6 +284,11 @@ export default sfc; // activate IDE's Vue plugin
<div class="message" v-if="showNoResults">
{{ textNoResults }}
</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>
</template>