|
1 |
| -{{$release := .release}} |
2 |
| -{{$defaultBranch := $.root.BranchName}}{{if and .root.IsViewTag (not .noTag)}}{{$defaultBranch = .root.TagName}}{{end}}{{if eq $defaultBranch ""}}{{$defaultBranch = $.root.Repository.DefaultBranch}}{{end}} |
3 |
| -{{$type := ""}}{{if and .root.IsViewTag (not .noTag)}}{{$type = "tag"}}{{else if .root.IsViewBranch}}{{$type = "branch"}}{{else}}{{$type = "tree"}}{{end}} |
| 1 | +{{$defaultBranch := $.root.BranchName}} |
| 2 | +{{if and .root.IsViewTag (not .noTag)}} |
| 3 | + {{$defaultBranch = .root.TagName}} |
| 4 | +{{end}} |
| 5 | +{{if eq $defaultBranch ""}} |
| 6 | + {{$defaultBranch = $.root.Repository.DefaultBranch}} |
| 7 | +{{end}} |
| 8 | + |
| 9 | +{{$type := ""}} |
| 10 | +{{if and .root.IsViewTag (not .noTag)}} |
| 11 | + {{$type = "tag"}} |
| 12 | +{{else if .root.IsViewBranch}} |
| 13 | + {{$type = "branch"}} |
| 14 | +{{else}} |
| 15 | + {{$type = "tree"}} |
| 16 | +{{end}} |
| 17 | + |
4 | 18 | {{$showBranchesInDropdown := not .root.HideBranchesInDropdown}}
|
5 | 19 |
|
6 | 20 | <script type="module">
|
|
30 | 44 | 'defaultBranch': {{$defaultBranch}},
|
31 | 45 | 'branchURLPrefix': '{{if .branchURLPrefix}}{{.branchURLPrefix}}{{else}}{{$.root.RepoLink}}/{{if $.root.PageIsCommits}}commits{{else}}src{{end}}/branch/{{end}}',
|
32 | 46 | 'branchURLSuffix': '{{if .branchURLSuffix}}{{.branchURLSuffix}}{{else}}{{if $.root.TreePath}}/{{PathEscapeSegments $.root.TreePath}}{{end}}{{end}}',
|
33 |
| - 'tagURLPrefix': '{{if .tagURLPrefix}}{{.tagURLPrefix}}{{else if $release}}{{$.root.RepoLink}}/compare/{{else}}{{$.root.RepoLink}}/{{if $.root.PageIsCommits}}commits{{else}}src{{end}}/tag/{{end}}', |
34 |
| - 'tagURLSuffix': '{{if .tagURLSuffix}}{{.tagURLSuffix}}{{else if $release}}...{{if $release.IsDraft}}{{PathEscapeSegments $release.Target}}{{else}}{{if $release.TagName}}{{PathEscapeSegments $release.TagName}}{{else}}{{PathEscapeSegments $release.Sha1}}{{end}}{{end}}{{else}}{{if $.root.TreePath}}/{{PathEscapeSegments $.root.TreePath}}{{end}}{{end}}', |
| 47 | + 'tagURLPrefix': '{{if .tagURLPrefix}}{{.tagURLPrefix}}{{else if .release}}{{$.root.RepoLink}}/compare/{{else}}{{$.root.RepoLink}}/{{if $.root.PageIsCommits}}commits{{else}}src{{end}}/tag/{{end}}', |
| 48 | + 'tagURLSuffix': '{{if .tagURLSuffix}}{{.tagURLSuffix}}{{else if .release}}...{{if .release.IsDraft}}{{PathEscapeSegments .release.Target}}{{else}}{{if .release.TagName}}{{PathEscapeSegments .release.TagName}}{{else}}{{PathEscapeSegments .release.Sha1}}{{end}}{{end}}{{else}}{{if $.root.TreePath}}/{{PathEscapeSegments $.root.TreePath}}{{end}}{{end}}', |
35 | 49 | 'repoLink': {{.root.RepoLink}},
|
36 | 50 | 'treePath': {{.root.TreePath}},
|
37 | 51 | 'branchNameSubURL': {{.root.BranchNameSubURL}},
|
|
46 | 60 | window.config.pageData.branchDropdownDataList.push(data);
|
47 | 61 | </script>
|
48 | 62 |
|
49 |
| -<div class="fitted item choose reference"> |
| 63 | +<div class="fitted item js-branch-tag-selector"> |
| 64 | + {{/* show dummy elements before Vue componment is mounted, this code must match the code in BranchTagSelector.vue */}} |
50 | 65 | <div class="ui floating filter dropdown custom">
|
51 |
| - <button class="branch-dropdown-button gt-ellipsis ui basic small compact button gt-df" @click="menuVisible = !menuVisible" @keyup.enter="menuVisible = !menuVisible"> |
| 66 | + <button class="branch-dropdown-button gt-ellipsis ui basic small compact button gt-df"> |
52 | 67 | <span class="text gt-df gt-ac gt-mr-2">
|
53 |
| - {{/* v-cloak is used to hide unnecessary elements before Vue componment is mounted */}} |
54 |
| - <span v-cloak v-if="release">${ textReleaseCompare }</span> |
55 |
| - <span :class="{visible: isViewTag}" v-if="isViewTag" {{if not (eq $type "tag")}}v-cloak{{end}}>{{svg "octicon-tag"}}</span> |
56 |
| - <span :class="{visible: isViewBranch}" v-if="isViewBranch" {{if not (eq $type "branch")}}v-cloak{{end}}>{{svg "octicon-git-branch"}}</span> |
57 |
| - <span :class="{visible: isViewTree}" v-if="isViewTree" {{if not (eq $type "tree")}}v-cloak{{end}}>{{svg "octicon-git-branch"}}</span> |
58 |
| - <strong ref="dropdownRefName" class="gt-ml-3">{{if and .root.IsViewTag (not .noTag)}}{{.root.TagName}}{{else if .root.IsViewBranch}}{{.root.BranchName}}{{else}}{{ShortSha .root.CommitID}}{{end}}</strong> |
| 68 | + {{if .release}} |
| 69 | + {{.root.locale.Tr "repo.release.compare"}} |
| 70 | + {{else}} |
| 71 | + {{if eq $type "tag"}} |
| 72 | + {{svg "octicon-tag"}} |
| 73 | + {{else}} |
| 74 | + {{svg "octicon-git-branch"}} |
| 75 | + {{end}} |
| 76 | + <strong ref="dropdownRefName" class="gt-ml-3">{{if and .root.IsViewTag (not .noTag)}}{{.root.TagName}}{{else if .root.IsViewBranch}}{{.root.BranchName}}{{else}}{{ShortSha .root.CommitID}}{{end}}</strong> |
| 77 | + {{end}} |
59 | 78 | </span>
|
60 | 79 | {{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
61 | 80 | </button>
|
62 |
| - <div class="menu transition" :class="{visible: menuVisible}" v-if="menuVisible" v-cloak> |
63 |
| - <div class="ui icon search input"> |
64 |
| - <i class="icon gt-df gt-ac gt-jc gt-m-0">{{svg "octicon-filter" 16}}</i> |
65 |
| - <input name="search" ref="searchField" autocomplete="off" v-model="searchTerm" @keydown="keydown($event)" :placeholder="searchFieldPlaceholder"> |
66 |
| - </div> |
67 |
| - <template v-if="showBranchesInDropdown"> |
68 |
| - <div class="header branch-tag-choice"> |
69 |
| - <div class="ui grid"> |
70 |
| - <div class="two column row"> |
71 |
| - <a class="reference column" href="#" @click="createTag = false; mode = 'branches'; focusSearchField()"> |
72 |
| - <span class="text" :class="{black: mode === 'branches'}"> |
73 |
| - {{svg "octicon-git-branch" 16 "gt-mr-2"}}${ textBranches } |
74 |
| - </span> |
75 |
| - </a> |
76 |
| - <template v-if="!noTag"> |
77 |
| - <a class="reference column" href="#" @click="createTag = true; mode = 'tags'; focusSearchField()"> |
78 |
| - <span class="text" :class="{black: mode === 'tags'}"> |
79 |
| - {{svg "octicon-tag" 16 "gt-mr-2"}}${ textTags } |
80 |
| - </span> |
81 |
| - </a> |
82 |
| - </template> |
83 |
| - </div> |
84 |
| - </div> |
85 |
| - </div> |
86 |
| - </template> |
87 |
| - <div class="scrolling menu" ref="scrollContainer"> |
88 |
| - <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> |
89 |
| - <div class="item" v-if="showCreateNewBranch" :class="{active: active === filteredItems.length}" :ref="'listItem' + filteredItems.length"> |
90 |
| - <a href="#" @click="createNewBranch()"> |
91 |
| - <div v-show="createTag"> |
92 |
| - <i class="reference tags icon"></i> |
93 |
| - <span v-html="textCreateTag.replace('%s', searchTerm)"></span> |
94 |
| - </div> |
95 |
| - <div v-show="!createTag"> |
96 |
| - {{svg "octicon-git-branch"}} |
97 |
| - <span v-html="textCreateBranch.replace('%s', searchTerm)"></span> |
98 |
| - </div> |
99 |
| - <div class="text small"> |
100 |
| - <span v-if="isViewBranch || release">${ textCreateBranchFrom.replace('%s', branchName) }</span> |
101 |
| - <span v-else-if="isViewTag">${ textCreateBranchFrom.replace('%s', tagName) }</span> |
102 |
| - <span v-else>${ textCreateBranchFrom.replace('%s', commitIdShort) }</span> |
103 |
| - </div> |
104 |
| - </a> |
105 |
| - <form ref="newBranchForm" action="{{.root.RepoLink}}/branches/_new/{{.root.BranchNameSubURL}}" method="post"> |
106 |
| - <input type="hidden" name="_csrf" :value="csrfToken"> |
107 |
| - <input type="hidden" name="new_branch_name" v-model="searchTerm"> |
108 |
| - <input type="hidden" name="create_tag" v-model="createTag"> |
109 |
| - <input type="hidden" name="current_path" v-model="treePath" v-if="treePath"> |
110 |
| - </form> |
111 |
| - </div> |
112 |
| - </div> |
113 |
| - <div class="message" v-if="showNoResults">${ noResults }</div> |
114 |
| - </div> |
115 | 81 | </div>
|
116 | 82 | </div>
|
0 commit comments