|
1 | | -<div class="fitted item choose reference mr-1"> |
2 | | - <div class="ui floating filter dropdown custom" data-can-create-branch="{{.CanCreateBranch}}" data-no-results="{{.i18n.Tr "repo.pulls.no_results"}}"> |
| 1 | +{{$release := .release}} |
| 2 | +{{$showBranchesInDropdown := not .root.HideBranchesInDropdown}} |
| 3 | +<div class="fitted item choose reference{{if not $release}} mr-1{{end}}"> |
| 4 | + <div class="ui floating filter dropdown custom" data-can-create-branch="{{.root.CanCreateBranch}}" data-no-results="{{.root.i18n.Tr "repo.pulls.no_results"}}"> |
3 | 5 | <div class="ui basic small compact button" @click="menuVisible = !menuVisible" @keyup.enter="menuVisible = !menuVisible"> |
4 | 6 | <span class="text"> |
5 | | - {{svg "octicon-git-branch"}} |
6 | | - {{if .IsViewBranch}}{{.i18n.Tr "repo.branch"}}{{else}}{{.i18n.Tr "repo.tree"}}{{end}}: |
7 | | - <strong>{{if .IsViewBranch}}{{.BranchName}}{{else}}{{ShortSha .BranchName}}{{end}}</strong> |
| 7 | + {{if $release}} |
| 8 | + {{.root.i18n.Tr "repo.release.compare"}} |
| 9 | + {{else}} |
| 10 | + {{svg "octicon-git-branch"}} |
| 11 | + {{if .root.IsViewBranch}}{{.root.i18n.Tr "repo.branch"}}{{else}}{{.root.i18n.Tr "repo.tree"}}{{end}}: |
| 12 | + <strong>{{if .root.IsViewBranch}}{{.root.BranchName}}{{else}}{{ShortSha .root.BranchName}}{{end}}</strong> |
| 13 | + {{end}} |
8 | 14 | </span> |
9 | 15 | {{svg "octicon-triangle-down" 14 "dropdown icon"}} |
10 | 16 | </div> |
11 | | - <div class="data" style="display: none" data-mode="{{if .IsViewTag}}tags{{else}}branches{{end}}"> |
12 | | - {{range .Branches}} |
13 | | - <div class="item branch {{if eq $.BranchName .}}selected{{end}}" data-url="{{$.RepoLink}}/{{if $.PageIsCommits}}commits{{else}}src{{end}}/branch/{{EscapePound .}}{{if $.TreePath}}/{{EscapePound $.TreePath}}{{end}}">{{.}}</div> |
| 17 | + <div class="data" style="display: none" data-mode="{{if .root.IsViewTag}}tags{{else}}branches{{end}}"> |
| 18 | + {{if $showBranchesInDropdown}} |
| 19 | + {{range .root.Branches}} |
| 20 | + <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> |
| 21 | + {{end}} |
14 | 22 | {{end}} |
15 | | - {{range .Tags}} |
16 | | - <div class="item tag {{if eq $.BranchName .}}selected{{end}}" data-url="{{$.RepoLink}}/{{if $.PageIsCommits}}commits{{else}}src{{end}}/tag/{{EscapePound .}}{{if $.TreePath}}/{{EscapePound $.TreePath}}{{end}}">{{.}}</div> |
| 23 | + {{range .root.Tags}} |
| 24 | + {{if $release}} |
| 25 | + <div class="item tag {{if eq $release.TagName .}}selected{{end}}" data-url="{{$.root.RepoLink}}/compare/{{EscapePound .}}...{{if $release.TagName}}{{EscapePound $release.TagName}}{{else}}{{EscapePound $release.Sha1}}{{end}}">{{.}}</div> |
| 26 | + {{else}} |
| 27 | + <div class="item tag {{if eq $.root.BranchName .}}selected{{end}}" data-url="{{$.root.RepoLink}}/{{if $.root.PageIsCommits}}commits{{else}}src{{end}}/tag/{{EscapePound .}}{{if $.root.TreePath}}/{{EscapePound $.root.TreePath}}{{end}}">{{.}}</div> |
| 28 | + {{end}} |
17 | 29 | {{end}} |
18 | 30 | </div> |
19 | 31 | <div class="menu transition" :class="{visible: menuVisible}" v-if="menuVisible" v-cloak> |
20 | 32 | <div class="ui icon search input"> |
21 | 33 | <i class="icon df ac jc m-0">{{svg "octicon-filter" 16}}</i> |
22 | | - <input name="search" ref="searchField" v-model="searchTerm" @keydown="keydown($event)" placeholder="{{.i18n.Tr "repo.filter_branch_and_tag"}}..."> |
| 34 | + <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}}..."> |
23 | 35 | </div> |
24 | | - <div class="header branch-tag-choice"> |
25 | | - <div class="ui grid"> |
26 | | - <div class="two column row"> |
27 | | - <a class="reference column" href="#" @click="createTag = false; mode = 'branches'; focusSearchField()"> |
28 | | - <span class="text" :class="{black: mode == 'branches'}"> |
29 | | - {{svg "octicon-git-branch" 16 "mr-2"}}{{.i18n.Tr "repo.branches"}} |
30 | | - </span> |
31 | | - </a> |
32 | | - <a class="reference column" href="#" @click="createTag = true; mode = 'tags'; focusSearchField()"> |
33 | | - <span class="text" :class="{black: mode == 'tags'}"> |
34 | | - {{svg "octicon-tag" 16 "mr-2"}}{{.i18n.Tr "repo.tags"}} |
35 | | - </span> |
36 | | - </a> |
| 36 | + {{if $showBranchesInDropdown}} |
| 37 | + <div class="header branch-tag-choice"> |
| 38 | + <div class="ui grid"> |
| 39 | + <div class="two column row"> |
| 40 | + <a class="reference column" href="#" @click="createTag = false; mode = 'branches'; focusSearchField()"> |
| 41 | + <span class="text" :class="{black: mode == 'branches'}"> |
| 42 | + {{svg "octicon-git-branch" 16 "mr-2"}}{{.root.i18n.Tr "repo.branches"}} |
| 43 | + </span> |
| 44 | + </a> |
| 45 | + <a class="reference column" href="#" @click="createTag = true; mode = 'tags'; focusSearchField()"> |
| 46 | + <span class="text" :class="{black: mode == 'tags'}"> |
| 47 | + {{svg "octicon-tag" 16 "mr-2"}}{{.root.i18n.Tr "repo.tags"}} |
| 48 | + </span> |
| 49 | + </a> |
| 50 | + </div> |
37 | 51 | </div> |
38 | 52 | </div> |
39 | | - </div> |
| 53 | + {{end}} |
40 | 54 | <div class="scrolling menu" ref="scrollContainer"> |
41 | 55 | <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 }</div> |
42 | 56 | <div class="item" v-if="showCreateNewBranch" :class="{active: active == filteredItems.length}" :ref="'listItem' + filteredItems.length"> |
43 | 57 | <a href="#" @click="createNewBranch()"> |
44 | 58 | <div v-show="createTag"> |
45 | 59 | <i class="reference tags icon"></i> |
46 | | - {{.i18n.Tr "repo.tag.create_tag" `${ searchTerm }` | Safe}} |
| 60 | + {{.root.i18n.Tr "repo.tag.create_tag" `${ searchTerm }` | Safe}} |
47 | 61 | </div> |
48 | 62 | <div v-show="!createTag"> |
49 | 63 | {{svg "octicon-git-branch"}} |
50 | | - {{.i18n.Tr "repo.branch.create_branch" `${ searchTerm }` | Safe}} |
| 64 | + {{.root.i18n.Tr "repo.branch.create_branch" `${ searchTerm }` | Safe}} |
51 | 65 | </div> |
52 | 66 | <div class="text small"> |
53 | | - {{if .IsViewBranch}} |
54 | | - {{.i18n.Tr "repo.branch.create_from" .BranchName}} |
| 67 | + {{if or .root.IsViewBranch $release}} |
| 68 | + {{.root.i18n.Tr "repo.branch.create_from" .root.BranchName}} |
55 | 69 | {{else}} |
56 | | - {{.i18n.Tr "repo.branch.create_from" (ShortSha .BranchName)}} |
| 70 | + {{.root.i18n.Tr "repo.branch.create_from" (ShortSha .root.BranchName)}} |
57 | 71 | {{end}} |
58 | 72 | </div> |
59 | 73 | </a> |
60 | | - <form ref="newBranchForm" action="{{.RepoLink}}/branches/_new/{{EscapePound .BranchNameSubURL}}" method="post"> |
61 | | - {{.CsrfTokenHtml}} |
| 74 | + <form ref="newBranchForm" action="{{.root.RepoLink}}/branches/_new/{{EscapePound .root.BranchNameSubURL}}" method="post"> |
| 75 | + {{.root.CsrfTokenHtml}} |
62 | 76 | <input type="hidden" name="new_branch_name" v-model="searchTerm"> |
63 | 77 | <input type="hidden" name="create_tag" v-model="createTag"> |
64 | 78 | </form> |
|
0 commit comments