@@ -57,8 +57,9 @@ const (
57
57
tplProtectedBranch base.TplName = "repo/settings/protected_branch"
58
58
)
59
59
60
- // Settings show a repository's settings page
61
- func Settings(ctx *context.Context) {
60
+ // SettingsCtxData is a middleware that sets all the general context data for the
61
+ // settings template.
62
+ func SettingsCtxData(ctx *context.Context) {
62
63
ctx.Data["Title"] = ctx.Tr("repo.settings")
63
64
ctx.Data["PageIsSettingsOptions"] = true
64
65
ctx.Data["ForcePrivate"] = setting.Repository.ForcePrivate
@@ -94,15 +95,16 @@ func Settings(ctx *context.Context) {
94
95
return
95
96
}
96
97
ctx.Data["PushMirrors"] = pushMirrors
98
+ }
97
99
100
+ // Settings show a repository's settings page
101
+ func Settings(ctx *context.Context) {
98
102
ctx.HTML(http.StatusOK, tplSettingsOptions)
99
103
}
100
104
101
105
// SettingsPost response for changes of a repository
102
106
func SettingsPost(ctx *context.Context) {
103
107
form := web.GetForm(ctx).(*forms.RepoSettingForm)
104
- ctx.Data["Title"] = ctx.Tr("repo.settings")
105
- ctx.Data["PageIsSettingsOptions"] = true
106
108
107
109
ctx.Data["ForcePrivate"] = setting.Repository.ForcePrivate
108
110
ctx.Data["MirrorsEnabled"] = setting.Mirror.Enabled
@@ -827,7 +829,7 @@ func handleSettingRemoteAddrError(ctx *context.Context, err error, form *forms.R
827
829
case addrErr.IsProtocolInvalid:
828
830
ctx.RenderWithErr(ctx.Tr("repo.mirror_address_protocol_invalid"), tplSettingsOptions, form)
829
831
case addrErr.IsURLError:
830
- ctx.RenderWithErr(ctx.Tr("form.url_error"), tplSettingsOptions, form)
832
+ ctx.RenderWithErr(ctx.Tr("form.url_error", addrErr.Host ), tplSettingsOptions, form)
831
833
case addrErr.IsPermissionDenied:
832
834
if addrErr.LocalPath {
833
835
ctx.RenderWithErr(ctx.Tr("repo.migrate.permission_denied"), tplSettingsOptions, form)
0 commit comments