Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 10 commits into from
Dec 2, 2024
1 change: 1 addition & 0 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,7 @@ 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
all_tags = 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
Expand Down
3 changes: 3 additions & 0 deletions templates/repo/branch_dropdown.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@
'textCreateBranch': {{ctx.Locale.Tr "repo.branch.create_branch"}},
'textCreateBranchFrom': {{ctx.Locale.Tr "repo.branch.create_from"}},
'textBranches': {{ctx.Locale.Tr "repo.branches"}},
'textAllBranches': {{ctx.Locale.Tr "repo.all_branches"}},
'textAllTags': {{ctx.Locale.Tr "repo.all_tags"}},
'textTags': {{ctx.Locale.Tr "repo.tags"}},
'textDefaultBranchLabel': {{ctx.Locale.Tr "repo.default_branch_label"}},

'mode': '{{if or .root.IsViewTag .isTag}}tags{{else}}branches{{end}}',
'showBranchesInDropdown': {{$showBranchesInDropdown}},
'showAllBranchsTagsEntry': {{$.showAllBranchsTagsEntry}},
wxiaoguang marked this conversation as resolved.
Show resolved Hide resolved
'searchFieldPlaceholder': '{{if $.noTag}}{{ctx.Locale.Tr "repo.pulls.filter_branch"}}{{else if $showBranchesInDropdown}}{{ctx.Locale.Tr "repo.filter_branch_and_tag"}}{{else}}{{ctx.Locale.Tr "repo.find_tag"}}{{end}}...',
'branchForm': {{$.branchForm}},
'disableCreateBranch': {{if .disableCreateBranch}}{{.disableCreateBranch}}{{else}}{{not .root.CanCreateBranch}}{{end}},
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/home.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
{{$isHomepage := (eq $n 0)}}
<div class="repo-button-row" data-is-homepage="{{$isHomepage}}">
<div class="repo-button-row-left">
{{template "repo/branch_dropdown" dict "root" .}}
{{template "repo/branch_dropdown" dict "root" . "showAllBranchsTagsEntry" true}}
{{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}}
{{$cmpBranch := ""}}
{{if ne .Repository.ID .BaseRepo.ID}}
Expand Down
5 changes: 4 additions & 1 deletion web_src/css/repo.css
Original file line number Diff line number Diff line change
Expand Up @@ -2851,10 +2851,13 @@ tbody.commit-list {
}

.branch-selector-dropdown .branch-tag-divider {
margin-top: -1px !important;
border-top: 1px solid var(--color-secondary);
}

.branch-selector-dropdown .branch-tag-tab + .branch-tag-divider {
margin-top: -1px !important;
}

.branch-selector-dropdown .scrolling.menu {
border-top: none !important;
}
Expand Down
3 changes: 3 additions & 0 deletions web_src/js/components/RepoBranchTagSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,9 @@ export default sfc; // activate IDE's Vue plugin
<div class="message" v-if="showNoResults && !isLoading">
{{ noResults }}
</div>
<div v-if="showAllBranchsTagsEntry" class="branch-tag-divider"/>
<a v-if="showAllBranchsTagsEntry && mode === 'branches'" class="item" :href="repoLink + '/branches'">{{ textAllBranches }}</a>
<a v-if="showAllBranchsTagsEntry && mode === 'tags'" class="item" :href="repoLink + '/tags'">{{ textAllTags }}</a>
</div>
</div>
</template>
Loading