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 default label in branch select list #26697

Merged
2 changes: 2 additions & 0 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ confirm_delete_selected = Confirm to delete all selected items?
name = Name
value = Value

default = Default

[aria]
navbar = Navigation Bar
footer = Footer
Expand Down
1 change: 1 addition & 0 deletions templates/repo/branch_dropdown.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
'textCreateBranchFrom': {{.root.locale.Tr "repo.branch.create_from"}},
'textBranches': {{.root.locale.Tr "repo.branches"}},
'textTags': {{.root.locale.Tr "repo.tags"}},
'textDefault': {{.root.locale.Tr "default"}},

'mode': '{{if or .root.IsViewTag .isTag}}tags{{else}}branches{{end}}',
'showBranchesInDropdown': {{$showBranchesInDropdown}},
Expand Down
4 changes: 4 additions & 0 deletions web_src/js/components/RepoBranchTagSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
<div class="loading-indicator is-loading" v-if="isLoading"/>
<div v-for="(item, index) in filteredItems" :key="item.name" class="item" :class="{selected: item.selected, active: active === index}" @click="selectItem(item)" :ref="'listItem' + index">
{{ item.name }}
<!-- in backend, we put default branch as the first item, so just check item index is enought here -->
<div class="ui label" v-if="index===0 && mode === 'branches'">
{{ textDefault }}
</div>
<a v-show="enableFeed && mode === 'branches'" role="button" class="rss-icon ui compact right" :href="rssURLPrefix + item.url" target="_blank" @click.stop>
<!-- creating a lot of Vue component is pretty slow, so we use a static SVG here -->
<svg width="14" height="14" class="svg octicon-rss"><use href="#svg-symbol-octicon-rss"/></svg>
Expand Down