|
@@ -26,36 +26,36 @@ import (
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
const (
|
|
|
- // SETTINGS_OPTIONS page template
|
|
|
|
|
- SETTINGS_OPTIONS = "repo/settings/options"
|
|
|
|
|
|
|
+ // SettingsOptionsTPL page template
|
|
|
|
|
+ SettingsOptionsTPL = "repo/settings/options"
|
|
|
|
|
|
|
|
- // SETTINGS_REPO_AVATAR page template
|
|
|
|
|
- SETTINGS_REPO_AVATAR = "repo/settings/avatar"
|
|
|
|
|
|
|
+ // SettingsRepoAvatarTPL page template
|
|
|
|
|
+ SettingsRepoAvatarTPL = "repo/settings/avatar"
|
|
|
|
|
|
|
|
- // SETTINGS_COLLABORATION page template
|
|
|
|
|
- SETTINGS_COLLABORATION = "repo/settings/collaboration"
|
|
|
|
|
|
|
+ // SettingsCollaborationTPL page template
|
|
|
|
|
+ SettingsCollaborationTPL = "repo/settings/collaboration"
|
|
|
|
|
|
|
|
- // SETTINGS_BRANCHES page template
|
|
|
|
|
- SETTINGS_BRANCHES = "repo/settings/branches"
|
|
|
|
|
|
|
+ // SettingsBranchesTPL page template
|
|
|
|
|
+ SettingsBranchesTPL = "repo/settings/branches"
|
|
|
|
|
|
|
|
- // SETTINGS_PROTECTED_BRANCH page template
|
|
|
|
|
- SETTINGS_PROTECTED_BRANCH = "repo/settings/protected_branch"
|
|
|
|
|
|
|
+ // SettingsProtectedBranchTPL page template
|
|
|
|
|
+ SettingsProtectedBranchTPL = "repo/settings/protected_branch"
|
|
|
|
|
|
|
|
- // SETTINGS_GITHOOKS page template
|
|
|
|
|
- SETTINGS_GITHOOKS = "repo/settings/githooks"
|
|
|
|
|
|
|
+ // SettingsGitHooksTPL page template
|
|
|
|
|
+ SettingsGitHooksTPL = "repo/settings/githooks"
|
|
|
|
|
|
|
|
- // SETTINGS_GITHOOK_EDIT page template
|
|
|
|
|
- SETTINGS_GITHOOK_EDIT = "repo/settings/githook_edit"
|
|
|
|
|
|
|
+ // SettingsGitHookEditTPL page template
|
|
|
|
|
+ SettingsGitHookEditTPL = "repo/settings/githook_edit"
|
|
|
|
|
|
|
|
- // SETTINGS_DEPLOY_KEYS page template
|
|
|
|
|
- SETTINGS_DEPLOY_KEYS = "repo/settings/deploy_keys"
|
|
|
|
|
|
|
+ // SettingsDeployKeysTPL page template
|
|
|
|
|
+ SettingsDeployKeysTPL = "repo/settings/deploy_keys"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
func Settings(c *context.Context) {
|
|
func Settings(c *context.Context) {
|
|
|
c.Title("repo.settings")
|
|
c.Title("repo.settings")
|
|
|
c.PageIs("SettingsOptions")
|
|
c.PageIs("SettingsOptions")
|
|
|
c.RequireAutosize()
|
|
c.RequireAutosize()
|
|
|
- c.Success(SETTINGS_OPTIONS)
|
|
|
|
|
|
|
+ c.Success(SettingsOptionsTPL)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func SettingsPost(c *context.Context, f form.RepoSetting) {
|
|
func SettingsPost(c *context.Context, f form.RepoSetting) {
|
|
@@ -68,7 +68,7 @@ func SettingsPost(c *context.Context, f form.RepoSetting) {
|
|
|
switch c.Query("action") {
|
|
switch c.Query("action") {
|
|
|
case "update":
|
|
case "update":
|
|
|
if c.HasError() {
|
|
if c.HasError() {
|
|
|
- c.Success(SETTINGS_OPTIONS)
|
|
|
|
|
|
|
+ c.Success(SettingsOptionsTPL)
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -82,11 +82,11 @@ func SettingsPost(c *context.Context, f form.RepoSetting) {
|
|
|
c.FormErr("RepoName")
|
|
c.FormErr("RepoName")
|
|
|
switch {
|
|
switch {
|
|
|
case models.IsErrRepoAlreadyExist(err):
|
|
case models.IsErrRepoAlreadyExist(err):
|
|
|
- c.RenderWithErr(c.Tr("form.repo_name_been_taken"), SETTINGS_OPTIONS, &f)
|
|
|
|
|
|
|
+ c.RenderWithErr(c.Tr("form.repo_name_been_taken"), SettingsOptionsTPL, &f)
|
|
|
case models.IsErrNameReserved(err):
|
|
case models.IsErrNameReserved(err):
|
|
|
- c.RenderWithErr(c.Tr("repo.form.name_reserved", err.(models.ErrNameReserved).Name), SETTINGS_OPTIONS, &f)
|
|
|
|
|
|
|
+ c.RenderWithErr(c.Tr("repo.form.name_reserved", err.(models.ErrNameReserved).Name), SettingsOptionsTPL, &f)
|
|
|
case models.IsErrNamePatternNotAllowed(err):
|
|
case models.IsErrNamePatternNotAllowed(err):
|
|
|
- c.RenderWithErr(c.Tr("repo.form.name_pattern_not_allowed", err.(models.ErrNamePatternNotAllowed).Pattern), SETTINGS_OPTIONS, &f)
|
|
|
|
|
|
|
+ c.RenderWithErr(c.Tr("repo.form.name_pattern_not_allowed", err.(models.ErrNamePatternNotAllowed).Pattern), SettingsOptionsTPL, &f)
|
|
|
default:
|
|
default:
|
|
|
c.ServerError("ChangeRepositoryName", err)
|
|
c.ServerError("ChangeRepositoryName", err)
|
|
|
}
|
|
}
|
|
@@ -190,7 +190,7 @@ func SettingsPost(c *context.Context, f form.RepoSetting) {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
if repo.Name != f.RepoName {
|
|
if repo.Name != f.RepoName {
|
|
|
- c.RenderWithErr(c.Tr("form.enterred_invalid_repo_name"), SETTINGS_OPTIONS, nil)
|
|
|
|
|
|
|
+ c.RenderWithErr(c.Tr("form.enterred_invalid_repo_name"), SettingsOptionsTPL, nil)
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -224,7 +224,7 @@ func SettingsPost(c *context.Context, f form.RepoSetting) {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
if repo.Name != f.RepoName {
|
|
if repo.Name != f.RepoName {
|
|
|
- c.RenderWithErr(c.Tr("form.enterred_invalid_repo_name"), SETTINGS_OPTIONS, nil)
|
|
|
|
|
|
|
+ c.RenderWithErr(c.Tr("form.enterred_invalid_repo_name"), SettingsOptionsTPL, nil)
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -241,13 +241,13 @@ func SettingsPost(c *context.Context, f form.RepoSetting) {
|
|
|
c.ServerError("IsUserExist", err)
|
|
c.ServerError("IsUserExist", err)
|
|
|
return
|
|
return
|
|
|
} else if !isExist {
|
|
} else if !isExist {
|
|
|
- c.RenderWithErr(c.Tr("form.enterred_invalid_owner_name"), SETTINGS_OPTIONS, nil)
|
|
|
|
|
|
|
+ c.RenderWithErr(c.Tr("form.enterred_invalid_owner_name"), SettingsOptionsTPL, nil)
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if err = models.TransferOwnership(c.User, newOwner, repo); err != nil {
|
|
if err = models.TransferOwnership(c.User, newOwner, repo); err != nil {
|
|
|
if models.IsErrRepoAlreadyExist(err) {
|
|
if models.IsErrRepoAlreadyExist(err) {
|
|
|
- c.RenderWithErr(c.Tr("repo.settings.new_owner_has_same_repo"), SETTINGS_OPTIONS, nil)
|
|
|
|
|
|
|
+ c.RenderWithErr(c.Tr("repo.settings.new_owner_has_same_repo"), SettingsOptionsTPL, nil)
|
|
|
} else {
|
|
} else {
|
|
|
c.ServerError("TransferOwnership", err)
|
|
c.ServerError("TransferOwnership", err)
|
|
|
}
|
|
}
|
|
@@ -263,7 +263,7 @@ func SettingsPost(c *context.Context, f form.RepoSetting) {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
if repo.Name != f.RepoName {
|
|
if repo.Name != f.RepoName {
|
|
|
- c.RenderWithErr(c.Tr("form.enterred_invalid_repo_name"), SETTINGS_OPTIONS, nil)
|
|
|
|
|
|
|
+ c.RenderWithErr(c.Tr("form.enterred_invalid_repo_name"), SettingsOptionsTPL, nil)
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -289,7 +289,7 @@ func SettingsPost(c *context.Context, f form.RepoSetting) {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
if repo.Name != f.RepoName {
|
|
if repo.Name != f.RepoName {
|
|
|
- c.RenderWithErr(c.Tr("form.enterred_invalid_repo_name"), SETTINGS_OPTIONS, nil)
|
|
|
|
|
|
|
+ c.RenderWithErr(c.Tr("form.enterred_invalid_repo_name"), SettingsOptionsTPL, nil)
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -320,7 +320,7 @@ func SettingsPost(c *context.Context, f form.RepoSetting) {
|
|
|
func SettingsAvatar(c *context.Context) {
|
|
func SettingsAvatar(c *context.Context) {
|
|
|
c.Title("settings.avatar")
|
|
c.Title("settings.avatar")
|
|
|
c.PageIs("SettingsAvatar")
|
|
c.PageIs("SettingsAvatar")
|
|
|
- c.Success(SETTINGS_REPO_AVATAR)
|
|
|
|
|
|
|
+ c.Success(SettingsRepoAvatarTPL)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func SettingsAvatarPost(c *context.Context, f form.Avatar) {
|
|
func SettingsAvatarPost(c *context.Context, f form.Avatar) {
|
|
@@ -385,7 +385,7 @@ func SettingsCollaboration(c *context.Context) {
|
|
|
}
|
|
}
|
|
|
c.Data["Collaborators"] = users
|
|
c.Data["Collaborators"] = users
|
|
|
|
|
|
|
|
- c.HTML(200, SETTINGS_COLLABORATION)
|
|
|
|
|
|
|
+ c.HTML(200, SettingsCollaborationTPL)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func SettingsCollaborationPost(c *context.Context) {
|
|
func SettingsCollaborationPost(c *context.Context) {
|
|
@@ -456,7 +456,7 @@ func SettingsBranches(c *context.Context) {
|
|
|
|
|
|
|
|
if c.Repo.Repository.IsBare {
|
|
if c.Repo.Repository.IsBare {
|
|
|
c.Flash.Info(c.Tr("repo.settings.branches_bare"), true)
|
|
c.Flash.Info(c.Tr("repo.settings.branches_bare"), true)
|
|
|
- c.HTML(200, SETTINGS_BRANCHES)
|
|
|
|
|
|
|
+ c.HTML(200, SettingsBranchesTPL)
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -475,7 +475,7 @@ func SettingsBranches(c *context.Context) {
|
|
|
}
|
|
}
|
|
|
c.Data["ProtectBranches"] = branches
|
|
c.Data["ProtectBranches"] = branches
|
|
|
|
|
|
|
|
- c.HTML(200, SETTINGS_BRANCHES)
|
|
|
|
|
|
|
+ c.HTML(200, SettingsBranchesTPL)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func UpdateDefaultBranch(c *context.Context) {
|
|
func UpdateDefaultBranch(c *context.Context) {
|
|
@@ -546,7 +546,7 @@ func SettingsProtectedBranch(c *context.Context) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
c.Data["Branch"] = protectBranch
|
|
c.Data["Branch"] = protectBranch
|
|
|
- c.HTML(200, SETTINGS_PROTECTED_BRANCH)
|
|
|
|
|
|
|
+ c.HTML(200, SettingsProtectedBranchTPL)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func SettingsProtectedBranchPost(c *context.Context, f form.ProtectBranch) {
|
|
func SettingsProtectedBranchPost(c *context.Context, f form.ProtectBranch) {
|
|
@@ -598,7 +598,7 @@ func SettingsGitHooks(c *context.Context) {
|
|
|
}
|
|
}
|
|
|
c.Data["Hooks"] = hooks
|
|
c.Data["Hooks"] = hooks
|
|
|
|
|
|
|
|
- c.HTML(200, SETTINGS_GITHOOKS)
|
|
|
|
|
|
|
+ c.HTML(200, SettingsGitHooksTPL)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func SettingsGitHooksEdit(c *context.Context) {
|
|
func SettingsGitHooksEdit(c *context.Context) {
|
|
@@ -617,7 +617,7 @@ func SettingsGitHooksEdit(c *context.Context) {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
c.Data["Hook"] = hook
|
|
c.Data["Hook"] = hook
|
|
|
- c.HTML(200, SETTINGS_GITHOOK_EDIT)
|
|
|
|
|
|
|
+ c.HTML(200, SettingsGitHookEditTPL)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func SettingsGitHooksEditPost(c *context.Context) {
|
|
func SettingsGitHooksEditPost(c *context.Context) {
|
|
@@ -650,7 +650,7 @@ func SettingsDeployKeys(c *context.Context) {
|
|
|
}
|
|
}
|
|
|
c.Data["Deploykeys"] = keys
|
|
c.Data["Deploykeys"] = keys
|
|
|
|
|
|
|
|
- c.HTML(200, SETTINGS_DEPLOY_KEYS)
|
|
|
|
|
|
|
+ c.HTML(200, SettingsDeployKeysTPL)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func SettingsDeployKeysPost(c *context.Context, f form.AddSSHKey) {
|
|
func SettingsDeployKeysPost(c *context.Context, f form.AddSSHKey) {
|
|
@@ -665,7 +665,7 @@ func SettingsDeployKeysPost(c *context.Context, f form.AddSSHKey) {
|
|
|
c.Data["Deploykeys"] = keys
|
|
c.Data["Deploykeys"] = keys
|
|
|
|
|
|
|
|
if c.HasError() {
|
|
if c.HasError() {
|
|
|
- c.HTML(200, SETTINGS_DEPLOY_KEYS)
|
|
|
|
|
|
|
+ c.HTML(200, SettingsDeployKeysTPL)
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -688,10 +688,10 @@ func SettingsDeployKeysPost(c *context.Context, f form.AddSSHKey) {
|
|
|
switch {
|
|
switch {
|
|
|
case models.IsErrKeyAlreadyExist(err):
|
|
case models.IsErrKeyAlreadyExist(err):
|
|
|
c.Data["Err_Content"] = true
|
|
c.Data["Err_Content"] = true
|
|
|
- c.RenderWithErr(c.Tr("repo.settings.key_been_used"), SETTINGS_DEPLOY_KEYS, &f)
|
|
|
|
|
|
|
+ c.RenderWithErr(c.Tr("repo.settings.key_been_used"), SettingsDeployKeysTPL, &f)
|
|
|
case models.IsErrKeyNameAlreadyUsed(err):
|
|
case models.IsErrKeyNameAlreadyUsed(err):
|
|
|
c.Data["Err_Title"] = true
|
|
c.Data["Err_Title"] = true
|
|
|
- c.RenderWithErr(c.Tr("repo.settings.key_name_used"), SETTINGS_DEPLOY_KEYS, &f)
|
|
|
|
|
|
|
+ c.RenderWithErr(c.Tr("repo.settings.key_name_used"), SettingsDeployKeysTPL, &f)
|
|
|
default:
|
|
default:
|
|
|
c.Handle(500, "AddDeployKey", err)
|
|
c.Handle(500, "AddDeployKey", err)
|
|
|
}
|
|
}
|