gitea源码

branch_selector_field.tmpl 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. {{/* TODO: RemoveIssueRef: the Issue.Ref will be removed in 1.24 or 1.25 if no end user really needs it or there could be better alternative then.
  2. PR: https://github.com/go-gitea/gitea/pull/32744
  3. The Issue.Ref was added by Add possibility to record branch or tag information in an issue (#780)
  4. After 8 years, this "branch selector" does nothing more than saving the branch/tag name into database and displays it.
  5. There are still users using it:
  6. * @didim99: it is a really useful feature to specify a branch in which issue found.
  7. Still needs to figure out:
  8. * Could the "recording branch/tag name" be replaced by other approaches?
  9. * Write the branch name in the issue title/body then it will still be displayed, eg: `[bug] (fix/ui-broken-bug) there is a bug ....`
  10. * Is "GitHub-like development sidebar (`#31899`)" good enough (or better) for your usage?
  11. */}}
  12. {{if and (not .Issue.IsPull) (not .PageIsComparePull)}}
  13. <input id="ref_selector" name="ref" type="hidden" value="{{.Reference}}">
  14. <div class="ui dropdown select-branch branch-selector-dropdown ellipsis-text-items {{if not .HasIssuesOrPullsWritePermission}}disabled{{end}}"
  15. data-no-results="{{ctx.Locale.Tr "no_results_found"}}"
  16. {{if and .Issue (or .IsIssueWriter .HasIssuesOrPullsWritePermission)}}data-url-update-issueref="{{$.RepoLink}}/issues/{{.Issue.Index}}/ref"{{end}}
  17. >
  18. <div class="ui button branch-dropdown-button">
  19. <span class="text-branch-name gt-ellipsis">{{if .Reference}}{{$.RefEndName}}{{else}}{{ctx.Locale.Tr "repo.issues.no_ref"}}{{end}}</span>
  20. {{if .HasIssuesOrPullsWritePermission}}{{svg "octicon-triangle-down" 14 "dropdown icon"}}{{end}}
  21. </div>
  22. <div class="menu">
  23. <div class="ui icon search input">
  24. <i class="icon">{{svg "octicon-filter" 16}}</i>
  25. <input name="search" placeholder="{{ctx.Locale.Tr "repo.filter_branch_and_tag"}}...">
  26. </div>
  27. <div class="branch-tag-tab">
  28. <a class="branch-tag-item reference column muted active" href="#" data-target="#branch-list">
  29. {{svg "octicon-git-branch" 16 "tw-mr-1"}} {{ctx.Locale.Tr "repo.branches"}}
  30. </a>
  31. <a class="branch-tag-item reference column muted" href="#" data-target="#tag-list">
  32. {{svg "octicon-tag" 16 "tw-mr-1"}} {{ctx.Locale.Tr "repo.tags"}}
  33. </a>
  34. </div>
  35. <div class="branch-tag-divider"></div>
  36. <div id="branch-list" class="scrolling menu reference-list-menu">
  37. {{if or .Reference (not .Issue)}}
  38. <div class="item text small" data-id="" data-name="{{ctx.Locale.Tr "repo.issues.no_ref"}}" data-id-selector="#ref_selector"><strong><a href="#">{{ctx.Locale.Tr "repo.clear_ref"}}</a></strong></div>
  39. {{end}}
  40. {{range .Branches}}
  41. <div class="item" data-id="refs/heads/{{.}}" data-name="{{.}}" data-id-selector="#ref_selector" title="{{.}}">{{.}}</div>
  42. {{else}}
  43. <div class="item disabled">{{ctx.Locale.Tr "no_results_found"}}</div>
  44. {{end}}
  45. </div>
  46. <div id="tag-list" class="scrolling menu reference-list-menu tw-hidden">
  47. {{if or .Reference (not .Issue)}}
  48. <div class="item text small" data-id="" data-name="{{ctx.Locale.Tr "repo.issues.no_ref"}}" data-id-selector="#ref_selector"><strong><a href="#">{{ctx.Locale.Tr "repo.clear_ref"}}</a></strong></div>
  49. {{end}}
  50. {{range .Tags}}
  51. <div class="item" data-id="refs/tags/{{.}}" data-name="tags/{{.}}" data-id-selector="#ref_selector">{{.}}</div>
  52. {{else}}
  53. <div class="item disabled">{{ctx.Locale.Tr "no_results_found"}}</div>
  54. {{end}}
  55. </div>
  56. </div>
  57. </div>
  58. <div class="divider"></div>
  59. {{end}}