예제 #1
0
파일: home.go 프로젝트: gigforks/gogs
func showOrgProfile(ctx *context.Context) {
	ctx.SetParams(":org", ctx.Params(":username"))
	context.HandleOrgAssignment(ctx)
	if ctx.Written() {
		return
	}

	org := ctx.Org.Organization
	ctx.Data["Title"] = org.FullName

	if ctx.IsSigned {
		if ctx.User.IsAdmin {
			repos, err := models.GetRepositories(org.Id, true)
			if err != nil {
				ctx.Handle(500, "GetRepositoriesAsAdmin", err)
				return
			}
			ctx.Data["Repos"] = repos
		} else {
			if err := org.GetUserRepositories(ctx.User.Id); err != nil {
				ctx.Handle(500, "GetUserRepositories", err)
				return
			}
			ctx.Data["Repos"] = org.Repos
		}
	} else {
		repos, err := models.GetRepositories(org.Id, false)
		if err != nil {
			ctx.Handle(500, "GetRepositories", err)
			return
		}
		ctx.Data["Repos"] = repos
	}

	if err := org.GetMembers(); err != nil {
		ctx.Handle(500, "GetMembers", err)
		return
	}
	ctx.Data["Members"] = org.Members

	ctx.Data["Teams"] = org.Teams

	ctx.HTML(200, ORG_HOME)
}