summaryrefslogtreecommitdiffstats
path: root/routers/org
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
parent3f38ff6c09f0497980ad13fda9803907cee6d612 (diff)
downloadgitea-5c4bc3c848fb4bd46ad5ceeacd82cdfa8f2b5635.tar.gz
gitea-5c4bc3c848fb4bd46ad5ceeacd82cdfa8f2b5635.zip
Huge updates!!!!! Be careful to merge!!!!
Diffstat (limited to 'routers/org')
-rw-r--r--routers/org/members.go6
-rw-r--r--routers/org/org.go36
-rw-r--r--routers/org/teams.go26
3 files changed, 31 insertions, 37 deletions
diff --git a/routers/org/members.go b/routers/org/members.go
index c6f49b14bd..ac278d4e6d 100644
--- a/routers/org/members.go
+++ b/routers/org/members.go
@@ -5,12 +5,10 @@
package org
import (
- "github.com/go-martini/martini"
-
"github.com/gogits/gogs/modules/middleware"
)
-func Members(ctx *middleware.Context, params martini.Params) {
- ctx.Data["Title"] = "Organization " + params["org"] + " Members"
+func Members(ctx *middleware.Context) {
+ ctx.Data["Title"] = "Organization " + ctx.Params(":org") + " Members"
ctx.HTML(200, "org/members")
}
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)
diff --git a/routers/org/teams.go b/routers/org/teams.go
index 0b17f46368..d494ddc04d 100644
--- a/routers/org/teams.go
+++ b/routers/org/teams.go
@@ -5,8 +5,6 @@
package org
import (
- "github.com/go-martini/martini"
-
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/auth"
"github.com/gogits/gogs/modules/base"
@@ -19,10 +17,10 @@ const (
TEAM_NEW base.TplName = "org/team_new"
)
-func Teams(ctx *middleware.Context, params martini.Params) {
- ctx.Data["Title"] = "Organization " + params["org"] + " Teams"
+func Teams(ctx *middleware.Context) {
+ ctx.Data["Title"] = "Organization " + ctx.Params(":org") + " Teams"
- org, err := models.GetUserByName(params["org"])
+ org, err := models.GetUserByName(ctx.Params(":org"))
if err != nil {
if err == models.ErrUserNotExist {
ctx.Handle(404, "org.Teams(GetUserByName)", err)
@@ -48,8 +46,8 @@ func Teams(ctx *middleware.Context, params martini.Params) {
ctx.HTML(200, TEAMS)
}
-func NewTeam(ctx *middleware.Context, params martini.Params) {
- org, err := models.GetUserByName(params["org"])
+func NewTeam(ctx *middleware.Context) {
+ org, err := models.GetUserByName(ctx.Params(":org"))
if err != nil {
if err == models.ErrUserNotExist {
ctx.Handle(404, "org.NewTeam(GetUserByName)", err)
@@ -69,8 +67,8 @@ func NewTeam(ctx *middleware.Context, params martini.Params) {
ctx.HTML(200, TEAM_NEW)
}
-func NewTeamPost(ctx *middleware.Context, params martini.Params, form auth.CreateTeamForm) {
- org, err := models.GetUserByName(params["org"])
+func NewTeamPost(ctx *middleware.Context, form auth.CreateTeamForm) {
+ org, err := models.GetUserByName(ctx.Params(":org"))
if err != nil {
if err == models.ErrUserNotExist {
ctx.Handle(404, "org.NewTeamPost(GetUserByName)", err)
@@ -125,12 +123,12 @@ func NewTeamPost(ctx *middleware.Context, params martini.Params, form auth.Creat
ctx.Redirect("/org/" + org.LowerName + "/teams/" + t.LowerName)
}
-func EditTeam(ctx *middleware.Context, params martini.Params) {
- ctx.Data["Title"] = "Organization " + params["org"] + " Edit Team"
+func EditTeam(ctx *middleware.Context) {
+ ctx.Data["Title"] = "Organization " + ctx.Params(":org") + " Edit Team"
ctx.HTML(200, "org/edit_team")
}
-func SingleTeam(ctx *middleware.Context,params martini.Params){
- ctx.Data["Title"] = "single-team"+params["org"]
- ctx.HTML(200,"org/team")
+func SingleTeam(ctx *middleware.Context) {
+ ctx.Data["Title"] = "single-team" + ctx.Params(":org")
+ ctx.HTML(200, "org/team")
}