summaryrefslogtreecommitdiffstats
path: root/routers/org/members.go
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2014-08-16 16:21:17 +0800
committerUnknwon <joe2010xtmf@163.com>2014-08-16 16:21:17 +0800
commitbba707de36d9bfbdb3001e3e89fac0c072aa14e9 (patch)
tree2b3ee7fc662baea04cecdf14b8a2758c108f83cc /routers/org/members.go
parent78add502d71dca43bb59ab9ad91745c64d0bf74d (diff)
downloadgitea-bba707de36d9bfbdb3001e3e89fac0c072aa14e9.tar.gz
gitea-bba707de36d9bfbdb3001e3e89fac0c072aa14e9.zip
Finish team list, create new team, join/leave team page
Diffstat (limited to 'routers/org/members.go')
-rw-r--r--routers/org/members.go22
1 files changed, 17 insertions, 5 deletions
diff --git a/routers/org/members.go b/routers/org/members.go
index d98061765a..1e249e8be2 100644
--- a/routers/org/members.go
+++ b/routers/org/members.go
@@ -14,13 +14,13 @@ import (
)
const (
- MEMBERS base.TplName = "org/members"
- INVITE base.TplName = "org/invite"
+ MEMBERS base.TplName = "org/member/members"
+ MEMBER_INVITE base.TplName = "org/member/invite"
)
func Members(ctx *middleware.Context) {
org := ctx.Org.Organization
- ctx.Data["Title"] = org.Name
+ ctx.Data["Title"] = org.FullName
ctx.Data["PageIsOrgMembers"] = true
if err := org.GetMembers(); err != nil {
@@ -60,6 +60,18 @@ func MembersAction(ctx *middleware.Context) {
return
}
err = org.RemoveMember(uid)
+ if err == models.ErrLastOrgOwner {
+ ctx.Flash.Error(ctx.Tr("form.last_org_owner"))
+ ctx.Redirect(ctx.Org.OrgLink + "/members")
+ return
+ }
+ case "leave":
+ err = org.RemoveMember(ctx.User.Id)
+ if err == models.ErrLastOrgOwner {
+ ctx.Flash.Error(ctx.Tr("form.last_org_owner"))
+ ctx.Redirect(ctx.Org.OrgLink + "/members")
+ return
+ }
}
if err != nil {
@@ -75,7 +87,7 @@ func MembersAction(ctx *middleware.Context) {
func Invitation(ctx *middleware.Context) {
org := ctx.Org.Organization
- ctx.Data["Title"] = org.Name
+ ctx.Data["Title"] = org.FullName
ctx.Data["PageIsOrgMembers"] = true
if ctx.Req.Method == "POST" {
@@ -101,5 +113,5 @@ func Invitation(ctx *middleware.Context) {
return
}
- ctx.HTML(200, INVITE)
+ ctx.HTML(200, MEMBER_INVITE)
}