Org action fixes and form cleanup (#10512) (#10514)

* More org fixes

* Move form action query to inputs

Signed-off-by: jolheiser <john.olheiser@gmail.com>
This commit is contained in:
John Olheiser 2020-02-27 19:38:21 -06:00 committed by GitHub
parent 4c40aa5be9
commit c6b78c3d31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 15 deletions

View file

@ -48,9 +48,15 @@
<div class="ui four wide column"> <div class="ui four wide column">
<div class="text right"> <div class="text right">
{{if eq $.SignedUser.ID .ID}} {{if eq $.SignedUser.ID .ID}}
<a class="ui red small button" href="{{$.OrgLink}}/members/action/leave?uid={{.ID}}">{{$.i18n.Tr "org.members.leave"}}</a> <form method="post" action="{{$.OrgLink}}/members/action/leave">
{{$.CsrfTokenHtml}}
<button type="submit" class="ui red small button" name="uid" value="{{.ID}}">{{$.i18n.Tr "org.members.leave"}}</button>
</form>
{{else if $.IsOrganizationOwner}} {{else if $.IsOrganizationOwner}}
<a class="ui red small button" href="{{$.OrgLink}}/members/action/remove?uid={{.ID}}">{{$.i18n.Tr "org.members.remove"}}</a> <form method="post" action="{{$.OrgLink}}/members/action/remove">
{{$.CsrfTokenHtml}}
<button type="submit" class="ui red small button" name="uid" value="{{.ID}}">{{$.i18n.Tr "org.members.remove"}}</button>
</form>
{{end}} {{end}}
</div> </div>
</div> </div>

View file

@ -27,9 +27,9 @@
{{range .Team.Members}} {{range .Team.Members}}
<div class="item"> <div class="item">
{{if $.IsOrganizationOwner}} {{if $.IsOrganizationOwner}}
<form method="post" action="{{$.OrgLink}}/teams/{{$.Team.LowerName}}/action/remove?uid={{.ID}}"> <form method="post" action="{{$.OrgLink}}/teams/{{$.Team.LowerName}}/action/remove">
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}
<button type="submit" class="ui red small button right" >{{$.i18n.Tr "org.members.remove"}}</button> <button type="submit" class="ui red small button right" name="uid" value="{{.ID}}">{{$.i18n.Tr "org.members.remove"}}</button>
</form> </form>
{{end}} {{end}}
<a href="{{.HomeLink}}"> <a href="{{.HomeLink}}">

View file

@ -35,9 +35,9 @@
{{range .Team.Repos}} {{range .Team.Repos}}
<div class="item"> <div class="item">
{{if $canAddRemove}} {{if $canAddRemove}}
<form method="post" action="{{$.OrgLink}}/teams/{{$.Team.LowerName}}/action/repo/remove?repoid={{.ID}}"> <form method="post" action="{{$.OrgLink}}/teams/{{$.Team.LowerName}}/action/repo/remove">
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}
<button type="submit" class="ui red small button right">{{$.i18n.Tr "remove"}}</button> <button type="submit" class="ui red small button right" name="repoid" value="{{.ID}}">{{$.i18n.Tr "remove"}}</button>
</form> </form>
{{end}} {{end}}
<a class="member" href="{{AppSubUrl}}/{{$.Org.Name}}/{{.Name}}"> <a class="member" href="{{AppSubUrl}}/{{$.Org.Name}}/{{.Name}}">

View file

@ -3,14 +3,16 @@
<strong>{{.Team.Name}}</strong> <strong>{{.Team.Name}}</strong>
<div class="ui right"> <div class="ui right">
{{if .Team.IsMember $.SignedUser.ID}} {{if .Team.IsMember $.SignedUser.ID}}
<form method="post" action="{{.OrgLink}}/teams/{{.Team.LowerName}}/action/leave?uid={{$.SignedUser.ID}}&page=home"> <form method="post" action="{{.OrgLink}}/teams/{{.Team.LowerName}}/action/leave">
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}
<button type="submit" class="ui red tiny button">{{$.i18n.Tr "org.teams.leave"}}</button> <input type="hidden" name="page" value="home"/>
<button type="submit" class="ui red tiny button" name="uid" value="{{$.SignedUser.ID}}">{{$.i18n.Tr "org.teams.leave"}}</button>
</form> </form>
{{else if .IsOrganizationOwner}} {{else if .IsOrganizationOwner}}
<form method="post" action="{{.OrgLink}}/teams/{{.Team.LowerName}}/action/join?uid={{$.SignedUser.ID}}&page=team"> <form method="post" action="{{.OrgLink}}/teams/{{.Team.LowerName}}/action/join">
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}
<button type="submit" class="ui blue tiny button">{{$.i18n.Tr "org.teams.join"}}</button> <input type="hidden" name="page" value="team"/>
<button type="submit" class="ui blue tiny button" name="uid" value="{{$.SignedUser.ID}}">{{$.i18n.Tr "org.teams.join"}}</button>
</form> </form>
{{end}} {{end}}
</div> </div>

View file

@ -17,14 +17,14 @@
<a class="text black" href="{{$.OrgLink}}/teams/{{.LowerName}}"><strong>{{.Name}}</strong></a> <a class="text black" href="{{$.OrgLink}}/teams/{{.LowerName}}"><strong>{{.Name}}</strong></a>
<div class="ui right"> <div class="ui right">
{{if .IsMember $.SignedUser.ID}} {{if .IsMember $.SignedUser.ID}}
<form method="post" action="{{$.OrgLink}}/teams/{{.LowerName}}/action/leave?uid={{$.SignedUser.ID}}"> <form method="post" action="{{$.OrgLink}}/teams/{{.LowerName}}/action/leave">
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}
<button type="submit" class="ui red small button">{{$.i18n.Tr "org.teams.leave"}}</button> <button type="submit" class="ui red small button" name="uid" value="{{$.SignedUser.ID}}">{{$.i18n.Tr "org.teams.leave"}}</button>
</form> </form>
{{else if $.IsOrganizationOwner}} {{else if $.IsOrganizationOwner}}
<form method="post" action="{{$.OrgLink}}/teams/{{.LowerName}}/action/join?uid={{$.SignedUser.ID}}"> <form method="post" action="{{$.OrgLink}}/teams/{{.LowerName}}/action/join">
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}
<button type="submit" class="ui blue small button">{{$.i18n.Tr "org.teams.join"}}</button> <button type="submit" class="ui blue small button" name="uid" value="{{$.SignedUser.ID}}">{{$.i18n.Tr "org.teams.join"}}</button>
</form> </form>
{{end}} {{end}}
</div> </div>

View file

@ -17,7 +17,10 @@
{{range .Orgs}} {{range .Orgs}}
<div class="item"> <div class="item">
<div class="right floated content"> <div class="right floated content">
<a class="ui blue small button" href="{{AppSubUrl}}/org/{{.Name}}/members/action/leave?uid={{.ID}}">{{$.i18n.Tr "org.members.leave"}}</a> <form method="post" action="{{AppSubUrl}}/org/{{.Name}}/members/action/leave">
{{$.CsrfTokenHtml}}
<button type="submit" class="ui blue small button" name="uid" value="{{.ID}}">{{$.i18n.Tr "org.members.leave"}}</button>
</form>
</div> </div>
<img class="ui mini image" src="{{.RelAvatarLink}}"> <img class="ui mini image" src="{{.RelAvatarLink}}">
<div class="content"> <div class="content">