You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

branch_dropdown.tmpl 3.7 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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"}}">
  3. <div class="ui basic small compact button" @click="menuVisible = !menuVisible" @keyup.enter="menuVisible = !menuVisible">
  4. <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>
  8. </span>
  9. {{svg "octicon-triangle-down" 14 "dropdown icon"}}
  10. </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>
  14. {{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>
  17. {{end}}
  18. </div>
  19. <div class="menu transition" :class="{visible: menuVisible}" v-if="menuVisible" v-cloak>
  20. <div class="ui icon search input">
  21. <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"}}...">
  23. </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>
  37. </div>
  38. </div>
  39. </div>
  40. <div class="scrolling menu" ref="scrollContainer">
  41. <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. <div class="item" v-if="showCreateNewBranch" :class="{active: active == filteredItems.length}" :ref="'listItem' + filteredItems.length">
  43. <a href="#" @click="createNewBranch()">
  44. <div v-show="createTag">
  45. <i class="reference tags icon"></i>
  46. {{.i18n.Tr "repo.tag.create_tag" `${ searchTerm }` | Safe}}
  47. </div>
  48. <div v-show="!createTag">
  49. {{svg "octicon-git-branch"}}
  50. {{.i18n.Tr "repo.branch.create_branch" `${ searchTerm }` | Safe}}
  51. </div>
  52. <div class="text small">
  53. {{if .IsViewBranch}}
  54. {{.i18n.Tr "repo.branch.create_from" .BranchName}}
  55. {{else}}
  56. {{.i18n.Tr "repo.branch.create_from" (ShortSha .BranchName)}}
  57. {{end}}
  58. </div>
  59. </a>
  60. <form ref="newBranchForm" action="{{.RepoLink}}/branches/_new/{{EscapePound .BranchNameSubURL}}" method="post">
  61. {{.CsrfTokenHtml}}
  62. <input type="hidden" name="new_branch_name" v-model="searchTerm">
  63. <input type="hidden" name="create_tag" v-model="createTag">
  64. </form>
  65. </div>
  66. </div>
  67. <div class="message" v-if="showNoResults">${ noResults }</div>
  68. </div>
  69. </div>
  70. </div>