mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Rename module: middleware -> context
This commit is contained in:
@@ -9,8 +9,8 @@ import (
|
||||
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/modules/context"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
"github.com/gogits/gogs/modules/middleware"
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@ const (
|
||||
MEMBER_INVITE base.TplName = "org/member/invite"
|
||||
)
|
||||
|
||||
func Members(ctx *middleware.Context) {
|
||||
func Members(ctx *context.Context) {
|
||||
org := ctx.Org.Organization
|
||||
ctx.Data["Title"] = org.FullName
|
||||
ctx.Data["PageIsOrgMembers"] = true
|
||||
@@ -33,7 +33,7 @@ func Members(ctx *middleware.Context) {
|
||||
ctx.HTML(200, MEMBERS)
|
||||
}
|
||||
|
||||
func MembersAction(ctx *middleware.Context) {
|
||||
func MembersAction(ctx *context.Context) {
|
||||
uid := com.StrTo(ctx.Query("uid")).MustInt64()
|
||||
if uid == 0 {
|
||||
ctx.Redirect(ctx.Org.OrgLink + "/members")
|
||||
@@ -91,7 +91,7 @@ func MembersAction(ctx *middleware.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
func Invitation(ctx *middleware.Context) {
|
||||
func Invitation(ctx *context.Context) {
|
||||
org := ctx.Org.Organization
|
||||
ctx.Data["Title"] = org.FullName
|
||||
ctx.Data["PageIsOrgMembers"] = true
|
||||
|
@@ -8,8 +8,8 @@ import (
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/modules/auth"
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/modules/context"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
"github.com/gogits/gogs/modules/middleware"
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
)
|
||||
|
||||
@@ -17,12 +17,12 @@ const (
|
||||
CREATE base.TplName = "org/create"
|
||||
)
|
||||
|
||||
func Create(ctx *middleware.Context) {
|
||||
func Create(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("new_org")
|
||||
ctx.HTML(200, CREATE)
|
||||
}
|
||||
|
||||
func CreatePost(ctx *middleware.Context, form auth.CreateOrgForm) {
|
||||
func CreatePost(ctx *context.Context, form auth.CreateOrgForm) {
|
||||
ctx.Data["Title"] = ctx.Tr("new_org")
|
||||
|
||||
if ctx.HasError() {
|
||||
|
@@ -12,8 +12,8 @@ import (
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/modules/auth"
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/modules/context"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
"github.com/gogits/gogs/modules/middleware"
|
||||
"github.com/gogits/gogs/modules/setting"
|
||||
"github.com/gogits/gogs/routers/user"
|
||||
)
|
||||
@@ -24,13 +24,13 @@ const (
|
||||
SETTINGS_HOOKS base.TplName = "org/settings/hooks"
|
||||
)
|
||||
|
||||
func Settings(ctx *middleware.Context) {
|
||||
func Settings(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("org.settings")
|
||||
ctx.Data["PageIsSettingsOptions"] = true
|
||||
ctx.HTML(200, SETTINGS_OPTIONS)
|
||||
}
|
||||
|
||||
func SettingsPost(ctx *middleware.Context, form auth.UpdateOrgSettingForm) {
|
||||
func SettingsPost(ctx *context.Context, form auth.UpdateOrgSettingForm) {
|
||||
ctx.Data["Title"] = ctx.Tr("org.settings")
|
||||
ctx.Data["PageIsSettingsOptions"] = true
|
||||
|
||||
@@ -85,7 +85,7 @@ func SettingsPost(ctx *middleware.Context, form auth.UpdateOrgSettingForm) {
|
||||
ctx.Redirect(ctx.Org.OrgLink + "/settings")
|
||||
}
|
||||
|
||||
func SettingsAvatar(ctx *middleware.Context, form auth.UploadAvatarForm) {
|
||||
func SettingsAvatar(ctx *context.Context, form auth.UploadAvatarForm) {
|
||||
form.Enable = true
|
||||
if err := user.UpdateAvatarSetting(ctx, form, ctx.Org.Organization); err != nil {
|
||||
ctx.Flash.Error(err.Error())
|
||||
@@ -96,7 +96,7 @@ func SettingsAvatar(ctx *middleware.Context, form auth.UploadAvatarForm) {
|
||||
ctx.Redirect(ctx.Org.OrgLink + "/settings")
|
||||
}
|
||||
|
||||
func SettingsDeleteAvatar(ctx *middleware.Context) {
|
||||
func SettingsDeleteAvatar(ctx *context.Context) {
|
||||
if err := ctx.Org.Organization.DeleteAvatar(); err != nil {
|
||||
ctx.Flash.Error(err.Error())
|
||||
}
|
||||
@@ -104,7 +104,7 @@ func SettingsDeleteAvatar(ctx *middleware.Context) {
|
||||
ctx.Redirect(ctx.Org.OrgLink + "/settings")
|
||||
}
|
||||
|
||||
func SettingsDelete(ctx *middleware.Context) {
|
||||
func SettingsDelete(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("org.settings")
|
||||
ctx.Data["PageIsSettingsDelete"] = true
|
||||
|
||||
@@ -136,7 +136,7 @@ func SettingsDelete(ctx *middleware.Context) {
|
||||
ctx.HTML(200, SETTINGS_DELETE)
|
||||
}
|
||||
|
||||
func Webhooks(ctx *middleware.Context) {
|
||||
func Webhooks(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("org.settings")
|
||||
ctx.Data["PageIsSettingsHooks"] = true
|
||||
ctx.Data["BaseLink"] = ctx.Org.OrgLink
|
||||
@@ -164,7 +164,7 @@ func Webhooks(ctx *middleware.Context) {
|
||||
ctx.HTML(200, SETTINGS_HOOKS)
|
||||
}
|
||||
|
||||
func DeleteWebhook(ctx *middleware.Context) {
|
||||
func DeleteWebhook(ctx *context.Context) {
|
||||
if err := models.DeleteWebhook(ctx.QueryInt64("id")); err != nil {
|
||||
ctx.Flash.Error("DeleteWebhook: " + err.Error())
|
||||
} else {
|
||||
|
@@ -12,8 +12,8 @@ import (
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/modules/auth"
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/modules/context"
|
||||
"github.com/gogits/gogs/modules/log"
|
||||
"github.com/gogits/gogs/modules/middleware"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -23,7 +23,7 @@ const (
|
||||
TEAM_REPOSITORIES base.TplName = "org/team/repositories"
|
||||
)
|
||||
|
||||
func Teams(ctx *middleware.Context) {
|
||||
func Teams(ctx *context.Context) {
|
||||
org := ctx.Org.Organization
|
||||
ctx.Data["Title"] = org.FullName
|
||||
ctx.Data["PageIsOrgTeams"] = true
|
||||
@@ -39,7 +39,7 @@ func Teams(ctx *middleware.Context) {
|
||||
ctx.HTML(200, TEAMS)
|
||||
}
|
||||
|
||||
func TeamsAction(ctx *middleware.Context) {
|
||||
func TeamsAction(ctx *context.Context) {
|
||||
uid := com.StrTo(ctx.Query("uid")).MustInt64()
|
||||
if uid == 0 {
|
||||
ctx.Redirect(ctx.Org.OrgLink + "/teams")
|
||||
@@ -107,7 +107,7 @@ func TeamsAction(ctx *middleware.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
func TeamsRepoAction(ctx *middleware.Context) {
|
||||
func TeamsRepoAction(ctx *context.Context) {
|
||||
if !ctx.Org.IsOwner {
|
||||
ctx.Error(404)
|
||||
return
|
||||
@@ -141,7 +141,7 @@ func TeamsRepoAction(ctx *middleware.Context) {
|
||||
ctx.Redirect(ctx.Org.OrgLink + "/teams/" + ctx.Org.Team.LowerName + "/repositories")
|
||||
}
|
||||
|
||||
func NewTeam(ctx *middleware.Context) {
|
||||
func NewTeam(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Org.Organization.FullName
|
||||
ctx.Data["PageIsOrgTeams"] = true
|
||||
ctx.Data["PageIsOrgTeamsNew"] = true
|
||||
@@ -149,7 +149,7 @@ func NewTeam(ctx *middleware.Context) {
|
||||
ctx.HTML(200, TEAM_NEW)
|
||||
}
|
||||
|
||||
func NewTeamPost(ctx *middleware.Context, form auth.CreateTeamForm) {
|
||||
func NewTeamPost(ctx *context.Context, form auth.CreateTeamForm) {
|
||||
ctx.Data["Title"] = ctx.Org.Organization.FullName
|
||||
ctx.Data["PageIsOrgTeams"] = true
|
||||
ctx.Data["PageIsOrgTeamsNew"] = true
|
||||
@@ -195,7 +195,7 @@ func NewTeamPost(ctx *middleware.Context, form auth.CreateTeamForm) {
|
||||
ctx.Redirect(ctx.Org.OrgLink + "/teams/" + t.LowerName)
|
||||
}
|
||||
|
||||
func TeamMembers(ctx *middleware.Context) {
|
||||
func TeamMembers(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Org.Team.Name
|
||||
ctx.Data["PageIsOrgTeams"] = true
|
||||
if err := ctx.Org.Team.GetMembers(); err != nil {
|
||||
@@ -205,7 +205,7 @@ func TeamMembers(ctx *middleware.Context) {
|
||||
ctx.HTML(200, TEAM_MEMBERS)
|
||||
}
|
||||
|
||||
func TeamRepositories(ctx *middleware.Context) {
|
||||
func TeamRepositories(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Org.Team.Name
|
||||
ctx.Data["PageIsOrgTeams"] = true
|
||||
if err := ctx.Org.Team.GetRepositories(); err != nil {
|
||||
@@ -215,7 +215,7 @@ func TeamRepositories(ctx *middleware.Context) {
|
||||
ctx.HTML(200, TEAM_REPOSITORIES)
|
||||
}
|
||||
|
||||
func EditTeam(ctx *middleware.Context) {
|
||||
func EditTeam(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Org.Organization.FullName
|
||||
ctx.Data["PageIsOrgTeams"] = true
|
||||
ctx.Data["team_name"] = ctx.Org.Team.Name
|
||||
@@ -223,7 +223,7 @@ func EditTeam(ctx *middleware.Context) {
|
||||
ctx.HTML(200, TEAM_NEW)
|
||||
}
|
||||
|
||||
func EditTeamPost(ctx *middleware.Context, form auth.CreateTeamForm) {
|
||||
func EditTeamPost(ctx *context.Context, form auth.CreateTeamForm) {
|
||||
t := ctx.Org.Team
|
||||
ctx.Data["Title"] = ctx.Org.Organization.FullName
|
||||
ctx.Data["PageIsOrgTeams"] = true
|
||||
@@ -270,7 +270,7 @@ func EditTeamPost(ctx *middleware.Context, form auth.CreateTeamForm) {
|
||||
ctx.Redirect(ctx.Org.OrgLink + "/teams/" + t.LowerName)
|
||||
}
|
||||
|
||||
func DeleteTeam(ctx *middleware.Context) {
|
||||
func DeleteTeam(ctx *context.Context) {
|
||||
if err := models.DeleteTeam(ctx.Org.Team); err != nil {
|
||||
ctx.Flash.Error("DeleteTeam: " + err.Error())
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user