6bbccdd177
Clarify the "link-action" behavior: > // A "link-action" can post AJAX request to its "data-url" > // Then the browser is redirect to: the "redirect" in response, or "data-redirect" attribute, or current URL by reloading. And enhance the "link-action" to support showing a modal dialog for confirm. A similar general approach could also help PRs like https://github.com/go-gitea/gitea/pull/22344#discussion_r1062883436 > // If the "link-action" has "data-modal-confirm(-html)" attribute, a confirm modal dialog will be shown before taking action. And a lot of duplicate code can be removed now. A good framework design can help to avoid code copying&pasting. --------- Co-authored-by: silverwind <me@silverwind.io>
61 lines
2.7 KiB
Handlebars
61 lines
2.7 KiB
Handlebars
{{template "base/head" .}}
|
|
<div role="main" aria-label="{{.Title}}" class="page-content organization teams">
|
|
{{template "org/header" .}}
|
|
<div class="ui container">
|
|
{{template "base/alert" .}}
|
|
<div class="ui stackable grid">
|
|
{{template "org/team/sidebar" .}}
|
|
<div class="ui ten wide column">
|
|
{{template "org/team/navbar" .}}
|
|
{{$canAddRemove := and $.IsOrganizationOwner (not $.Team.IncludesAllRepositories)}}
|
|
{{if $canAddRemove}}
|
|
<div class="ui attached segment gt-df gt-fw gt-gap-3">
|
|
<form class="ui form ignore-dirty gt-f1 gt-dif" action="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/repo/add" method="post">
|
|
{{.CsrfTokenHtml}}
|
|
<div id="search-repo-box" data-uid="{{.Org.ID}}" class="ui search">
|
|
<div class="ui input">
|
|
<input class="prompt" name="repo_name" placeholder="{{.locale.Tr "org.teams.search_repo_placeholder"}}" autocomplete="off" required>
|
|
</div>
|
|
</div>
|
|
<button class="ui green button gt-ml-3">{{.locale.Tr "add"}}</button>
|
|
</form>
|
|
<div class="gt-dib">
|
|
<button class="ui green button link-action" data-modal-confirm="{{.locale.Tr "org.teams.add_all_repos_desc"}}" data-url="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/repo/addall">{{.locale.Tr "add_all"}}</button>
|
|
<button class="ui red button link-action" data-modal-confirm="{{.locale.Tr "org.teams.remove_all_repos_desc"}}" data-url="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/repo/removeall">{{.locale.Tr "remove_all"}}</button>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
<div class="ui bottom attached table segment repositories">
|
|
{{range .Team.Repos}}
|
|
<div class="item gt-df gt-ac gt-fw">
|
|
{{if .IsPrivate}}
|
|
{{svg "octicon-lock" 16 "gt-mr-3"}}
|
|
{{else if .IsFork}}
|
|
{{svg "octicon-repo-forked" 16 "gt-mr-3"}}
|
|
{{else if .IsMirror}}
|
|
{{svg "octicon-mirror" 16 "gt-mr-3"}}
|
|
{{else}}
|
|
{{svg "octicon-repo" 16 "gt-mr-3"}}
|
|
{{end}}
|
|
<a class="member gt-f1" href="{{$.Org.HomeLink}}/{{.Name | PathEscape}}">
|
|
<strong>{{$.Org.Name}}/{{.Name}}</strong>
|
|
</a>
|
|
{{if $canAddRemove}}
|
|
<form method="post" action="{{$.OrgLink}}/teams/{{$.Team.LowerName | PathEscape}}/action/repo/remove">
|
|
{{$.CsrfTokenHtml}}
|
|
<button type="submit" class="ui red small button right" name="repoid" value="{{.ID}}">{{$.locale.Tr "remove"}}</button>
|
|
</form>
|
|
{{end}}
|
|
</div>
|
|
{{else}}
|
|
<div class="item">
|
|
<span class="text grey italic">{{$.locale.Tr "org.teams.repos.none"}}</span>
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{{template "base/footer" .}}
|