mirror of
https://github.com/go-gitea/gitea
synced 2025-07-03 09:07:19 +00:00
Clean up legacy form CSS styles (#33081)
This commit is contained in:
@ -147,27 +147,33 @@ func getRepoPrivate(ctx *context.Context) bool {
|
||||
}
|
||||
}
|
||||
|
||||
// Create render creating repository page
|
||||
func Create(ctx *context.Context) {
|
||||
func createCommon(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("new_repo")
|
||||
|
||||
// Give default value for template to render.
|
||||
ctx.Data["Gitignores"] = repo_module.Gitignores
|
||||
ctx.Data["LabelTemplateFiles"] = repo_module.LabelTemplateFiles
|
||||
ctx.Data["Licenses"] = repo_module.Licenses
|
||||
ctx.Data["Readmes"] = repo_module.Readmes
|
||||
ctx.Data["readme"] = "Default"
|
||||
ctx.Data["private"] = getRepoPrivate(ctx)
|
||||
ctx.Data["IsForcedPrivate"] = setting.Repository.ForcePrivate
|
||||
ctx.Data["default_branch"] = setting.Repository.DefaultBranch
|
||||
ctx.Data["CanCreateRepo"] = ctx.Doer.CanCreateRepo()
|
||||
ctx.Data["MaxCreationLimit"] = ctx.Doer.MaxCreationLimit()
|
||||
ctx.Data["SupportedObjectFormats"] = git.DefaultFeatures().SupportedObjectFormats
|
||||
ctx.Data["DefaultObjectFormat"] = git.Sha1ObjectFormat
|
||||
}
|
||||
|
||||
// Create render creating repository page
|
||||
func Create(ctx *context.Context) {
|
||||
createCommon(ctx)
|
||||
ctxUser := checkContextUser(ctx, ctx.FormInt64("org"))
|
||||
if ctx.Written() {
|
||||
return
|
||||
}
|
||||
ctx.Data["ContextUser"] = ctxUser
|
||||
|
||||
ctx.Data["readme"] = "Default"
|
||||
ctx.Data["private"] = getRepoPrivate(ctx)
|
||||
ctx.Data["default_branch"] = setting.Repository.DefaultBranch
|
||||
ctx.Data["repo_template_name"] = ctx.Tr("repo.template_select")
|
||||
|
||||
templateID := ctx.FormInt64("template_id")
|
||||
if templateID > 0 {
|
||||
templateRepo, err := repo_model.GetRepositoryByID(ctx, templateID)
|
||||
@ -177,11 +183,6 @@ func Create(ctx *context.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
ctx.Data["CanCreateRepo"] = ctx.Doer.CanCreateRepo()
|
||||
ctx.Data["MaxCreationLimit"] = ctx.Doer.MaxCreationLimit()
|
||||
ctx.Data["SupportedObjectFormats"] = git.DefaultFeatures().SupportedObjectFormats
|
||||
ctx.Data["DefaultObjectFormat"] = git.Sha1ObjectFormat
|
||||
|
||||
ctx.HTML(http.StatusOK, tplCreate)
|
||||
}
|
||||
|
||||
@ -219,16 +220,8 @@ func handleCreateError(ctx *context.Context, owner *user_model.User, err error,
|
||||
|
||||
// CreatePost response for creating repository
|
||||
func CreatePost(ctx *context.Context) {
|
||||
createCommon(ctx)
|
||||
form := web.GetForm(ctx).(*forms.CreateRepoForm)
|
||||
ctx.Data["Title"] = ctx.Tr("new_repo")
|
||||
|
||||
ctx.Data["Gitignores"] = repo_module.Gitignores
|
||||
ctx.Data["LabelTemplateFiles"] = repo_module.LabelTemplateFiles
|
||||
ctx.Data["Licenses"] = repo_module.Licenses
|
||||
ctx.Data["Readmes"] = repo_module.Readmes
|
||||
|
||||
ctx.Data["CanCreateRepo"] = ctx.Doer.CanCreateRepo()
|
||||
ctx.Data["MaxCreationLimit"] = ctx.Doer.MaxCreationLimit()
|
||||
|
||||
ctxUser := checkContextUser(ctx, form.UID)
|
||||
if ctx.Written() {
|
||||
@ -236,6 +229,14 @@ func CreatePost(ctx *context.Context) {
|
||||
}
|
||||
ctx.Data["ContextUser"] = ctxUser
|
||||
|
||||
if form.RepoTemplate > 0 {
|
||||
templateRepo, err := repo_model.GetRepositoryByID(ctx, form.RepoTemplate)
|
||||
if err == nil && access_model.CheckRepoUnitUser(ctx, templateRepo, ctxUser, unit.TypeCode) {
|
||||
ctx.Data["repo_template"] = form.RepoTemplate
|
||||
ctx.Data["repo_template_name"] = templateRepo.Name
|
||||
}
|
||||
}
|
||||
|
||||
if ctx.HasError() {
|
||||
ctx.HTML(http.StatusOK, tplCreate)
|
||||
return
|
||||
|
Reference in New Issue
Block a user