Skip to content

Commit 07dcbee

Browse files
committed
Change defaults to be more intuitive and remove unneeded option
1 parent eb8c54d commit 07dcbee

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

modules/context/repo.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -834,8 +834,6 @@ func RepoRefByType(refType RepoRefType) func(*Context) {
834834
ctx.Data["IsViewTag"] = ctx.Repo.IsViewTag
835835
ctx.Data["IsViewCommit"] = ctx.Repo.IsViewCommit
836836
ctx.Data["CanCreateBranch"] = ctx.Repo.CanCreateBranch()
837-
ctx.Data["ShowBranchesInDropdown"] = true
838-
ctx.Data["ShowTagsInDropdown"] = true
839837

840838
ctx.Repo.CommitsCount, err = ctx.Repo.GetCommitsCount()
841839
if err != nil {

routers/repo/release.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,9 @@ func releasesOrTags(ctx *context.Context, isTagList bool) {
7272
ctx.Data["DefaultBranch"] = ctx.Repo.Repository.DefaultBranch
7373
ctx.Data["IsViewBranch"] = false
7474
ctx.Data["IsViewTag"] = true
75-
// Disable the showCreateNewBranch form on this page.
75+
// Disable the showCreateNewBranch form in the dropdown on this page.
7676
ctx.Data["CanCreateBranch"] = false
77-
ctx.Data["ShowBranchesInDropdown"] = false
78-
ctx.Data["ShowTagsInDropdown"] = true
77+
ctx.Data["HideBranchesInDropdown"] = true
7978

8079
if isTagList {
8180
ctx.Data["Title"] = ctx.Tr("repo.release.tags")

templates/repo/branch_dropdown.tmpl

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{{$release := .release}}
2+
{{$showBranchesInDropdown := not .root.HideBranchesInDropdown}}
23
<div class="fitted item choose reference{{if not $release}} mr-1{{end}}">
34
<div class="ui floating filter dropdown custom" data-can-create-branch="{{.root.CanCreateBranch}}" data-no-results="{{.root.i18n.Tr "repo.pulls.no_results"}}">
45
<div class="ui basic small compact button" @click="menuVisible = !menuVisible" @keyup.enter="menuVisible = !menuVisible">
@@ -14,23 +15,21 @@
1415
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
1516
</div>
1617
<div class="data" style="display: none" data-mode="{{if .root.IsViewTag}}tags{{else}}branches{{end}}">
17-
{{if .root.ShowBranchesInDropdown}}
18+
{{if $showBranchesInDropdown}}
1819
{{range .root.Branches}}
1920
<div class="item branch {{if eq $.root.BranchName .}}selected{{end}}" data-url="{{$.root.RepoLink}}/{{if $.root.PageIsCommits}}commits{{else}}src{{end}}/branch/{{EscapePound .}}{{if $.root.TreePath}}/{{EscapePound $.root.TreePath}}{{end}}">{{.}}</div>
2021
{{end}}
2122
{{end}}
22-
{{if .root.ShowTagsInDropdown}}
23-
{{range .root.Tags}}
24-
<div class="item tag {{if eq $.root.BranchName .}}selected{{end}}" data-url="{{$.root.RepoLink}}/{{if $release}}compare/{{EscapePound .}}...{{if $release.TagName}}{{EscapePound $release.TagName}}{{else}}{{EscapePound $release.Sha1}}{{end}}{{else}}{{if $.root.PageIsCommits}}commits{{else}}src{{end}}/tag/{{EscapePound .}}{{if $.root.TreePath}}/{{EscapePound $.root.TreePath}}{{end}}{{end}}">{{.}}</div>
25-
{{end}}
23+
{{range .root.Tags}}
24+
<div class="item tag {{if eq $.root.BranchName .}}selected{{end}}" data-url="{{$.root.RepoLink}}/{{if $release}}compare/{{EscapePound .}}...{{if $release.TagName}}{{EscapePound $release.TagName}}{{else}}{{EscapePound $release.Sha1}}{{end}}{{else}}{{if $.root.PageIsCommits}}commits{{else}}src{{end}}/tag/{{EscapePound .}}{{if $.root.TreePath}}/{{EscapePound $.root.TreePath}}{{end}}{{end}}">{{.}}</div>
2625
{{end}}
2726
</div>
2827
<div class="menu transition" :class="{visible: menuVisible}" v-if="menuVisible" v-cloak>
2928
<div class="ui icon search input">
3029
<i class="icon df ac jc m-0">{{svg "octicon-filter" 16}}</i>
31-
<input name="search" ref="searchField" v-model="searchTerm" @keydown="keydown($event)" placeholder="{{if .root.ShowBranchesInDropdown}}{{.root.i18n.Tr "repo.filter_branch_and_tag"}}{{else}}{{.root.i18n.Tr "repo.find_tag"}}{{end}}...">
30+
<input name="search" ref="searchField" v-model="searchTerm" @keydown="keydown($event)" placeholder="{{if $showBranchesInDropdown}}{{.root.i18n.Tr "repo.filter_branch_and_tag"}}{{else}}{{.root.i18n.Tr "repo.find_tag"}}{{end}}...">
3231
</div>
33-
{{if and .root.ShowBranchesInDropdown .root.ShowTagsInDropdown}}
32+
{{if $showBranchesInDropdown}}
3433
<div class="header branch-tag-choice">
3534
<div class="ui grid">
3635
<div class="two column row">

0 commit comments

Comments
 (0)