summaryrefslogtreecommitdiffstats
path: root/routers/org/org.go
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2014-07-26 02:28:04 -0400
committerUnknwon <joe2010xtmf@163.com>2014-07-26 02:28:04 -0400
commit5c4bc3c848fb4bd46ad5ceeacd82cdfa8f2b5635 (patch)
tree213666141efaf773c4411d41482387f1250068f8 /routers/org/org.go
parent3f38ff6c09f0497980ad13fda9803907cee6d612 (diff)
downloadgitea-5c4bc3c848fb4bd46ad5ceeacd82cdfa8f2b5635.tar.gz
gitea-5c4bc3c848fb4bd46ad5ceeacd82cdfa8f2b5635.zip
Huge updates!!!!! Be careful to merge!!!!
Diffstat (limited to 'routers/org/org.go')
-rw-r--r--routers/org/org.go36
1 files changed, 17 insertions, 19 deletions
diff --git a/routers/org/org.go b/routers/org/org.go
index 4c8854974d..74527d6008 100644
--- a/routers/org/org.go
+++ b/routers/org/org.go
@@ -5,9 +5,7 @@
package org
import (
- "github.com/go-martini/martini"
-
- "github.com/gogits/gogs-ng/models"
+ "github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/auth"
"github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/log"
@@ -21,10 +19,10 @@ const (
SETTINGS base.TplName = "org/settings"
)
-func Home(ctx *middleware.Context, params martini.Params) {
- ctx.Data["Title"] = "Organization " + params["org"]
+func Home(ctx *middleware.Context) {
+ ctx.Data["Title"] = "Organization " + ctx.Params(":org")
- org, err := models.GetUserByName(params["org"])
+ org, err := models.GetUserByName(ctx.Params(":org"))
if err != nil {
if err == models.ErrUserNotExist {
ctx.Handle(404, "org.Home(GetUserByName)", err)
@@ -99,12 +97,12 @@ func NewPost(ctx *middleware.Context, form auth.CreateOrgForm) {
ctx.Redirect("/org/" + form.OrgName + "/dashboard")
}
-func Dashboard(ctx *middleware.Context, params martini.Params) {
+func Dashboard(ctx *middleware.Context) {
ctx.Data["Title"] = "Dashboard"
ctx.Data["PageIsUserDashboard"] = true
ctx.Data["PageIsOrgDashboard"] = true
- org, err := models.GetUserByName(params["org"])
+ org, err := models.GetUserByName(ctx.Params(":org"))
if err != nil {
if err == models.ErrUserNotExist {
ctx.Handle(404, "org.Dashboard(GetUserByName)", err)
@@ -114,11 +112,11 @@ func Dashboard(ctx *middleware.Context, params martini.Params) {
return
}
- // if err := ctx.User.GetOrganizations(); err != nil {
- // ctx.Handle(500, "home.Dashboard(GetOrganizations)", err)
- // return
- // }
- // ctx.Data["Orgs"] = ctx.User.Orgs
+ if err := ctx.User.GetOrganizations(); err != nil {
+ ctx.Handle(500, "home.Dashboard(GetOrganizations)", err)
+ return
+ }
+ ctx.Data["Orgs"] = ctx.User.Orgs
ctx.Data["ContextUser"] = org
ctx.Data["MyRepos"], err = models.GetRepositories(org.Id, true)
@@ -137,10 +135,10 @@ func Dashboard(ctx *middleware.Context, params martini.Params) {
ctx.HTML(200, user.DASHBOARD)
}
-func Settings(ctx *middleware.Context, params martini.Params) {
+func Settings(ctx *middleware.Context) {
ctx.Data["Title"] = "Settings"
- org, err := models.GetUserByName(params["org"])
+ org, err := models.GetUserByName(ctx.Params(":org"))
if err != nil {
if err == models.ErrUserNotExist {
ctx.Handle(404, "org.Settings(GetUserByName)", err)
@@ -154,10 +152,10 @@ func Settings(ctx *middleware.Context, params martini.Params) {
ctx.HTML(200, SETTINGS)
}
-func SettingsPost(ctx *middleware.Context, params martini.Params, form auth.OrgSettingForm) {
+func SettingsPost(ctx *middleware.Context, form auth.OrgSettingForm) {
ctx.Data["Title"] = "Settings"
- org, err := models.GetUserByName(params["org"])
+ org, err := models.GetUserByName(ctx.Params(":org"))
if err != nil {
if err == models.ErrUserNotExist {
ctx.Handle(404, "org.SettingsPost(GetUserByName)", err)
@@ -187,10 +185,10 @@ func SettingsPost(ctx *middleware.Context, params martini.Params, form auth.OrgS
ctx.Redirect("/org/" + org.Name + "/settings")
}
-func DeletePost(ctx *middleware.Context, params martini.Params) {
+func DeletePost(ctx *middleware.Context) {
ctx.Data["Title"] = "Settings"
- org, err := models.GetUserByName(params["org"])
+ org, err := models.GetUserByName(ctx.Params(":org"))
if err != nil {
if err == models.ErrUserNotExist {
ctx.Handle(404, "org.DeletePost(GetUserByName)", err)