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

127 line
5.6KB

  1. {{template "base/head" .}}
  2. <div class="repository settings collaboration">
  3. {{template "repo/header" .}}
  4. {{template "repo/settings/navbar" .}}
  5. <div class="ui container">
  6. {{template "base/alert" .}}
  7. <h4 class="ui top attached header">
  8. {{.i18n.Tr "repo.settings.collaboration"}}
  9. </h4>
  10. {{if .Collaborators}}
  11. <div class="ui attached segment collaborator list">
  12. {{range .Collaborators}}
  13. <div class="item ui grid">
  14. <div class="ui five wide column">
  15. <a href="{{AppSubUrl}}/{{.Name}}">
  16. <img class="ui avatar image" src="{{.RelAvatarLink}}">
  17. {{.DisplayName}}
  18. </a>
  19. </div>
  20. <div class="ui eight wide column">
  21. <span class="octicon octicon-shield"></span>
  22. <div class="ui inline dropdown">
  23. <div class="text">{{if eq .Collaboration.Mode 1}}{{$.i18n.Tr "repo.settings.collaboration.read"}}{{else if eq .Collaboration.Mode 2}}{{$.i18n.Tr "repo.settings.collaboration.write"}}{{else if eq .Collaboration.Mode 3}}{{$.i18n.Tr "repo.settings.collaboration.admin"}}{{else}}{{$.i18n.Tr "repo.settings.collaboration.undefined"}}{{end}}</div>
  24. <i class="dropdown icon"></i>
  25. <div class="access-mode menu" data-url="{{$.Link}}/access_mode" data-uid="{{.ID}}">
  26. <div class="item" data-text="{{$.i18n.Tr "repo.settings.collaboration.admin"}}" data-value="3">{{$.i18n.Tr "repo.settings.collaboration.admin"}}</div>
  27. <div class="item" data-text="{{$.i18n.Tr "repo.settings.collaboration.write"}}" data-value="2">{{$.i18n.Tr "repo.settings.collaboration.write"}}</div>
  28. <div class="item" data-text="{{$.i18n.Tr "repo.settings.collaboration.read"}}" data-value="1">{{$.i18n.Tr "repo.settings.collaboration.read"}}</div>
  29. </div>
  30. </div>
  31. </div>
  32. <div class="ui two wide column">
  33. <button class="ui red tiny button inline text-thin delete-button" data-url="{{$.Link}}/delete" data-id="{{.ID}}">
  34. {{$.i18n.Tr "repo.settings.delete_collaborator"}}
  35. </button>
  36. </div>
  37. </div>
  38. {{end}}
  39. </div>
  40. {{end}}
  41. <div class="ui bottom attached segment">
  42. <form class="ui form" id="repo-collab-form" action="{{.Link}}" method="post">
  43. {{.CsrfTokenHtml}}
  44. <div class="inline field ui left">
  45. <div id="search-user-box" class="ui search">
  46. <div class="ui input">
  47. <input class="prompt" name="collaborator" placeholder="{{.i18n.Tr "repo.settings.search_user_placeholder"}}" autocomplete="off" autofocus required>
  48. </div>
  49. </div>
  50. </div>
  51. <button class="ui green button">{{.i18n.Tr "repo.settings.add_collaborator"}}</button>
  52. </form>
  53. </div>
  54. {{if .RepoOwnerIsOrganization}}
  55. <h4 class="ui top attached header">
  56. Teams
  57. </h4>
  58. {{ $allowedToChangeTeams := ( or (.Org.RepoAdminChangeTeamAccess) (.Permission.IsOwner)) }}
  59. {{if .Teams}}
  60. <div class="ui attached segment collaborator list">
  61. {{range $t, $team := .Teams}}
  62. <div class="item ui grid">
  63. <div class="ui five wide column">
  64. <a href="{{AppSubUrl}}/org/{{$.OrgName}}/teams/{{.LowerName}}">
  65. {{.Name}}
  66. </a>
  67. </div>
  68. <div class="ui eight wide column poping up" data-content="Team's permission is set on the team setting page and can't be changed per repository">
  69. <span class="octicon octicon-shield"></span>
  70. <div class="ui inline dropdown">
  71. <div class="text">{{if eq .Authorize 1}}{{$.i18n.Tr "repo.settings.collaboration.read"}}{{else if eq .Authorize 2}}{{$.i18n.Tr "repo.settings.collaboration.write"}}{{else if eq .Authorize 3}}{{$.i18n.Tr "repo.settings.collaboration.admin"}}{{else if eq .Authorize 4}}{{$.i18n.Tr "repo.settings.collaboration.owner"}}{{else}}{{$.i18n.Tr "repo.settings.collaboration.undefined"}}{{end}}</div>
  72. </div>
  73. {{ if or (eq .Authorize 1) (eq .Authorize 2) }}
  74. {{ $first := true }}
  75. <div class="description">
  76. Sections: {{range $u, $unit := $.Units}}{{if and ($.Repo.UnitEnabled $unit.Type) ($team.UnitEnabled $unit.Type)}}{{if $first}}{{ $first = false }}{{else}}, {{end}}{{$.i18n.Tr $unit.NameKey}}{{end}}{{end}} {{if $first}}None{{end}}
  77. </div>
  78. {{end}}
  79. </div>
  80. {{if $allowedToChangeTeams}}
  81. {{ $globalRepoAccess := (eq .LowerName "owners") }}
  82. <div class="ui two wide column {{if $globalRepoAccess}}poping up{{end}}" {{if $globalRepoAccess}}data-content="This team has access to all repositories and can't be removed."{{end}}>
  83. <button class="ui red tiny button inline text-thin delete-button {{if $globalRepoAccess}}disabled{{end}}" data-url="{{$.Link}}/team/delete" data-id="{{.ID}}">
  84. {{$.i18n.Tr "repo.settings.delete_collaborator"}}
  85. </button>
  86. </div>
  87. {{end}}
  88. </div>
  89. {{end}}
  90. </div>
  91. {{end}}
  92. <div class="ui bottom attached segment">
  93. {{if $allowedToChangeTeams}}
  94. <form class="ui form" id="repo-collab-team-form" action="{{.Link}}/team" method="post">
  95. {{.CsrfTokenHtml}}
  96. <div class="inline field ui left">
  97. <div id="search-team-box" class="ui search" data-org="{{.OrgName}}">
  98. <div class="ui input">
  99. <input class="prompt" name="team" placeholder="Search teams..." autocomplete="off" autofocus required>
  100. </div>
  101. </div>
  102. </div>
  103. <button class="ui green button">Add Team</button>
  104. </form>
  105. {{else}}
  106. <div class="item">
  107. Changing team access for repository has been restricted to organization owner
  108. </div>
  109. {{end}}
  110. </div>
  111. {{end}}
  112. </div>
  113. </div>
  114. <div class="ui small basic delete modal">
  115. <div class="ui icon header">
  116. <i class="trash icon"></i>
  117. {{.i18n.Tr "repo.settings.collaborator_deletion"}}
  118. </div>
  119. <div class="content">
  120. <p>{{.i18n.Tr "repo.settings.collaborator_deletion_desc"}}</p>
  121. </div>
  122. {{template "base/delete_modal_actions" .}}
  123. </div>
  124. {{template "base/footer" .}}
上海开阖软件有限公司 沪ICP备12045867号-1