mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Refactor template & test related code (#32938)
Move some legacy code from "base" package to proper packages.
This commit is contained in:
@@ -18,7 +18,6 @@ import (
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
"code.gitea.io/gitea/models/unit"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/cache"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
@@ -27,6 +26,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/storage"
|
||||
api "code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/modules/templates"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/services/context"
|
||||
@@ -38,8 +38,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
tplCreate base.TplName = "repo/create"
|
||||
tplAlertDetails base.TplName = "base/alert_details"
|
||||
tplCreate templates.TplName = "repo/create"
|
||||
tplAlertDetails templates.TplName = "base/alert_details"
|
||||
)
|
||||
|
||||
// MustBeNotEmpty render when a repo is a empty git dir
|
||||
@@ -185,7 +185,7 @@ func Create(ctx *context.Context) {
|
||||
ctx.HTML(http.StatusOK, tplCreate)
|
||||
}
|
||||
|
||||
func handleCreateError(ctx *context.Context, owner *user_model.User, err error, name string, tpl base.TplName, form any) {
|
||||
func handleCreateError(ctx *context.Context, owner *user_model.User, err error, name string, tpl templates.TplName, form any) {
|
||||
switch {
|
||||
case repo_model.IsErrReachLimitOfRepo(err):
|
||||
maxCreationLimit := owner.MaxCreationLimit()
|
||||
@@ -304,8 +304,8 @@ func CreatePost(ctx *context.Context) {
|
||||
}
|
||||
|
||||
const (
|
||||
tplWatchUnwatch base.TplName = "repo/watch_unwatch"
|
||||
tplStarUnstar base.TplName = "repo/star_unstar"
|
||||
tplWatchUnwatch templates.TplName = "repo/watch_unwatch"
|
||||
tplStarUnstar templates.TplName = "repo/star_unstar"
|
||||
)
|
||||
|
||||
// Action response for actions to a repository
|
||||
|
Reference in New Issue
Block a user