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