gitea源码

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. {{/* Attributes:
  2. * ContainerClasses
  3. * Repository
  4. * CurrentRefType: eg. "branch", "tag", "commit"
  5. * CurrentRefShortName: eg. "master", "v1.0", "abcdef0123"
  6. * CurrentTreePath
  7. * RefLinkTemplate: redirect to the link when a branch/tag is selected
  8. * RefFormActionTemplate: change the parent form's action when a branch/tag is selected
  9. * DropdownFixedText: the text to show in the dropdown (mainly used by "release page"), if empty, the text will be the branch/tag name
  10. * ShowTabBranches
  11. * ShowTabTagsTab
  12. * AllowCreateNewRef
  13. * ShowViewAllRefsEntry
  14. Search "repo/branch_dropdown" in the template directory to find all occurrences.
  15. */}}
  16. <div class="{{if .ContainerClasses}}{{.ContainerClasses}}{{end}}"
  17. data-global-init="initRepoBranchTagSelector"
  18. data-text-release-compare="{{ctx.Locale.Tr "repo.release.compare"}}"
  19. data-text-branches="{{ctx.Locale.Tr "repo.branches"}}"
  20. data-text-tags="{{ctx.Locale.Tr "repo.tags"}}"
  21. data-text-filter-branch="{{ctx.Locale.Tr "repo.pulls.filter_branch"}}"
  22. data-text-filter-tag="{{ctx.Locale.Tr "repo.find_tag"}}"
  23. data-text-default-branch-label="{{ctx.Locale.Tr "repo.default_branch_label"}}"
  24. data-text-create-tag="{{ctx.Locale.Tr "repo.tag.create_tag"}}"
  25. data-text-create-branch="{{ctx.Locale.Tr "repo.branch.create_branch"}}"
  26. data-text-create-ref-from="{{ctx.Locale.Tr "repo.branch.create_from"}}"
  27. data-text-no-results="{{ctx.Locale.Tr "no_results_found"}}"
  28. data-text-view-all-branches="{{ctx.Locale.Tr "repo.view_all_branches"}}"
  29. data-text-view-all-tags="{{ctx.Locale.Tr "repo.view_all_tags"}}"
  30. data-current-repo-default-branch="{{.Repository.DefaultBranch}}"
  31. data-current-repo-link="{{.Repository.Link}}"
  32. data-current-tree-path="{{.CurrentTreePath}}"
  33. data-current-ref-type="{{.CurrentRefType}}"
  34. data-current-ref-short-name="{{.CurrentRefShortName}}"
  35. data-ref-link-template="{{.RefLinkTemplate}}"
  36. data-ref-form-action-template="{{.RefFormActionTemplate}}"
  37. data-dropdown-fixed-text="{{.DropdownFixedText}}"
  38. data-show-tab-branches="{{.ShowTabBranches}}"
  39. data-show-tab-tags="{{.ShowTabTags}}"
  40. data-allow-create-new-ref="{{.AllowCreateNewRef}}"
  41. data-show-view-all-refs-entry="{{.ShowViewAllRefsEntry}}"
  42. data-enable-feed="{{ctx.RootData.EnableFeed}}"
  43. >
  44. {{/* show dummy elements before Vue componment is mounted, this code must match the code in BranchTagSelector.vue */}}
  45. <div class="ui dropdown custom branch-selector-dropdown ellipsis-text-items">
  46. <div class="ui compact button branch-dropdown-button">
  47. <span class="flex-text-block gt-ellipsis">
  48. {{if .DropdownFixedText}}
  49. {{.DropdownFixedText}}
  50. {{else}}
  51. {{if eq .CurrentRefType "tag"}}
  52. {{svg "octicon-tag"}}
  53. {{else if eq .CurrentRefType "branch"}}
  54. {{svg "octicon-git-branch"}}
  55. {{else}}
  56. {{svg "octicon-git-commit"}}
  57. {{end}}
  58. <strong class="tw-inline-block gt-ellipsis">{{.CurrentRefShortName}}</strong>
  59. {{end}}
  60. </span>
  61. {{svg "octicon-triangle-down" 14 "dropdown icon"}}
  62. </div>
  63. </div>
  64. </div>