diff options
author | Unknwon <u@gogs.io> | 2017-04-05 09:17:21 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-04-05 09:17:21 -0400 |
commit | edaf14f2b6fd86f8dec99f67512a5c0095e391dc (patch) | |
tree | ec81011348a0c8df3995c36b46e2646472106800 /routers/repo | |
parent | 6fbb984ebf4f0d6804f0f83e6edb12ef0bb9a570 (diff) |
Refactoring: remove tool.TplName
Diffstat (limited to 'routers/repo')
-rw-r--r-- | routers/repo/branch.go | 5 | ||||
-rw-r--r-- | routers/repo/commit.go | 6 | ||||
-rw-r--r-- | routers/repo/editor.go | 10 | ||||
-rw-r--r-- | routers/repo/issue.go | 16 | ||||
-rw-r--r-- | routers/repo/pull.go | 10 | ||||
-rw-r--r-- | routers/repo/release.go | 5 | ||||
-rw-r--r-- | routers/repo/repo.go | 8 | ||||
-rw-r--r-- | routers/repo/setting.go | 15 | ||||
-rw-r--r-- | routers/repo/view.go | 12 | ||||
-rw-r--r-- | routers/repo/webhook.go | 9 | ||||
-rw-r--r-- | routers/repo/wiki.go | 9 |
11 files changed, 50 insertions, 55 deletions
diff --git a/routers/repo/branch.go b/routers/repo/branch.go index 12b62507..71e9337e 100644 --- a/routers/repo/branch.go +++ b/routers/repo/branch.go @@ -12,13 +12,12 @@ import ( "github.com/gogits/git-module" "github.com/gogits/gogs/models" - "github.com/gogits/gogs/pkg/tool" "github.com/gogits/gogs/pkg/context" ) const ( - BRANCHES_OVERVIEW tool.TplName = "repo/branches/overview" - BRANCHES_ALL tool.TplName = "repo/branches/all" + BRANCHES_OVERVIEW = "repo/branches/overview" + BRANCHES_ALL = "repo/branches/all" ) type Branch struct { diff --git a/routers/repo/commit.go b/routers/repo/commit.go index e51e81c8..19803dc6 100644 --- a/routers/repo/commit.go +++ b/routers/repo/commit.go @@ -11,14 +11,14 @@ import ( "github.com/gogits/git-module" "github.com/gogits/gogs/models" - "github.com/gogits/gogs/pkg/tool" "github.com/gogits/gogs/pkg/context" "github.com/gogits/gogs/pkg/setting" + "github.com/gogits/gogs/pkg/tool" ) const ( - COMMITS tool.TplName = "repo/commits" - DIFF tool.TplName = "repo/diff/page" + COMMITS = "repo/commits" + DIFF = "repo/diff/page" ) func RefCommits(ctx *context.Context) { diff --git a/routers/repo/editor.go b/routers/repo/editor.go index 710e70df..a8ce490a 100644 --- a/routers/repo/editor.go +++ b/routers/repo/editor.go @@ -15,18 +15,18 @@ import ( "github.com/gogits/git-module" "github.com/gogits/gogs/models" - "github.com/gogits/gogs/pkg/tool" "github.com/gogits/gogs/pkg/context" "github.com/gogits/gogs/pkg/form" "github.com/gogits/gogs/pkg/setting" "github.com/gogits/gogs/pkg/template" + "github.com/gogits/gogs/pkg/tool" ) const ( - EDIT_FILE tool.TplName = "repo/editor/edit" - EDIT_DIFF_PREVIEW tool.TplName = "repo/editor/diff_preview" - DELETE_FILE tool.TplName = "repo/editor/delete" - UPLOAD_FILE tool.TplName = "repo/editor/upload" + EDIT_FILE = "repo/editor/edit" + EDIT_DIFF_PREVIEW = "repo/editor/diff_preview" + DELETE_FILE = "repo/editor/delete" + UPLOAD_FILE = "repo/editor/upload" ) // getParentTreeFields returns list of parent tree names and corresponding tree paths diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 74501477..875ff8fe 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -19,23 +19,23 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/models/errors" - "github.com/gogits/gogs/pkg/tool" "github.com/gogits/gogs/pkg/context" "github.com/gogits/gogs/pkg/form" "github.com/gogits/gogs/pkg/markup" "github.com/gogits/gogs/pkg/setting" + "github.com/gogits/gogs/pkg/tool" ) const ( - ISSUES tool.TplName = "repo/issue/list" - ISSUE_NEW tool.TplName = "repo/issue/new" - ISSUE_VIEW tool.TplName = "repo/issue/view" + ISSUES = "repo/issue/list" + ISSUE_NEW = "repo/issue/new" + ISSUE_VIEW = "repo/issue/view" - LABELS tool.TplName = "repo/issue/labels" + LABELS = "repo/issue/labels" - MILESTONE tool.TplName = "repo/issue/milestones" - MILESTONE_NEW tool.TplName = "repo/issue/milestone_new" - MILESTONE_EDIT tool.TplName = "repo/issue/milestone_edit" + MILESTONE = "repo/issue/milestones" + MILESTONE_NEW = "repo/issue/milestone_new" + MILESTONE_EDIT = "repo/issue/milestone_edit" ISSUE_TEMPLATE_KEY = "IssueTemplate" ) diff --git a/routers/repo/pull.go b/routers/repo/pull.go index fc1a3817..6d420121 100644 --- a/routers/repo/pull.go +++ b/routers/repo/pull.go @@ -16,17 +16,17 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/models/errors" - "github.com/gogits/gogs/pkg/tool" "github.com/gogits/gogs/pkg/context" "github.com/gogits/gogs/pkg/form" "github.com/gogits/gogs/pkg/setting" + "github.com/gogits/gogs/pkg/tool" ) const ( - FORK tool.TplName = "repo/pulls/fork" - COMPARE_PULL tool.TplName = "repo/pulls/compare" - PULL_COMMITS tool.TplName = "repo/pulls/commits" - PULL_FILES tool.TplName = "repo/pulls/files" + FORK = "repo/pulls/fork" + COMPARE_PULL = "repo/pulls/compare" + PULL_COMMITS = "repo/pulls/commits" + PULL_FILES = "repo/pulls/files" PULL_REQUEST_TEMPLATE_KEY = "PullRequestTemplate" ) diff --git a/routers/repo/release.go b/routers/repo/release.go index b9fe3ada..3643ce69 100644 --- a/routers/repo/release.go +++ b/routers/repo/release.go @@ -11,7 +11,6 @@ import ( log "gopkg.in/clog.v1" "github.com/gogits/gogs/models" - "github.com/gogits/gogs/pkg/tool" "github.com/gogits/gogs/pkg/context" "github.com/gogits/gogs/pkg/form" "github.com/gogits/gogs/pkg/markup" @@ -19,8 +18,8 @@ import ( ) const ( - RELEASES tool.TplName = "repo/release/list" - RELEASE_NEW tool.TplName = "repo/release/new" + RELEASES = "repo/release/list" + RELEASE_NEW = "repo/release/new" ) // calReleaseNumCommitsBehind calculates given release has how many commits behind release target. diff --git a/routers/repo/repo.go b/routers/repo/repo.go index 2e00a80e..2781da9a 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -17,15 +17,15 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/models/errors" - "github.com/gogits/gogs/pkg/tool" "github.com/gogits/gogs/pkg/context" "github.com/gogits/gogs/pkg/form" "github.com/gogits/gogs/pkg/setting" + "github.com/gogits/gogs/pkg/tool" ) const ( - CREATE tool.TplName = "repo/create" - MIGRATE tool.TplName = "repo/migrate" + CREATE = "repo/create" + MIGRATE = "repo/migrate" ) func MustBeNotBare(ctx *context.Context) { @@ -85,7 +85,7 @@ func Create(ctx *context.Context) { ctx.HTML(200, CREATE) } -func handleCreateError(ctx *context.Context, owner *models.User, err error, name string, tpl tool.TplName, form interface{}) { +func handleCreateError(ctx *context.Context, owner *models.User, err error, name, tpl string, form interface{}) { switch { case models.IsErrReachLimitOfRepo(err): ctx.RenderWithErr(ctx.Tr("repo.form.reach_limit_of_creation", owner.RepoCreationNum()), tpl, form) diff --git a/routers/repo/setting.go b/routers/repo/setting.go index 70533118..6a049ead 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -15,7 +15,6 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/models/errors" - "github.com/gogits/gogs/pkg/tool" "github.com/gogits/gogs/pkg/context" "github.com/gogits/gogs/pkg/form" "github.com/gogits/gogs/pkg/mailer" @@ -23,13 +22,13 @@ import ( ) const ( - SETTINGS_OPTIONS tool.TplName = "repo/settings/options" - SETTINGS_COLLABORATION tool.TplName = "repo/settings/collaboration" - SETTINGS_BRANCHES tool.TplName = "repo/settings/branches" - SETTINGS_PROTECTED_BRANCH tool.TplName = "repo/settings/protected_branch" - SETTINGS_GITHOOKS tool.TplName = "repo/settings/githooks" - SETTINGS_GITHOOK_EDIT tool.TplName = "repo/settings/githook_edit" - SETTINGS_DEPLOY_KEYS tool.TplName = "repo/settings/deploy_keys" + SETTINGS_OPTIONS = "repo/settings/options" + SETTINGS_COLLABORATION = "repo/settings/collaboration" + SETTINGS_BRANCHES = "repo/settings/branches" + SETTINGS_PROTECTED_BRANCH = "repo/settings/protected_branch" + SETTINGS_GITHOOKS = "repo/settings/githooks" + SETTINGS_GITHOOK_EDIT = "repo/settings/githook_edit" + SETTINGS_DEPLOY_KEYS = "repo/settings/deploy_keys" ) func Settings(ctx *context.Context) { diff --git a/routers/repo/view.go b/routers/repo/view.go index 1559b984..0efa8ba2 100644 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -18,19 +18,19 @@ import ( "github.com/gogits/git-module" "github.com/gogits/gogs/models" - "github.com/gogits/gogs/pkg/tool" "github.com/gogits/gogs/pkg/context" "github.com/gogits/gogs/pkg/markup" "github.com/gogits/gogs/pkg/setting" "github.com/gogits/gogs/pkg/template" "github.com/gogits/gogs/pkg/template/highlight" + "github.com/gogits/gogs/pkg/tool" ) const ( - BARE tool.TplName = "repo/bare" - HOME tool.TplName = "repo/home" - WATCHERS tool.TplName = "repo/watchers" - FORKS tool.TplName = "repo/forks" + BARE = "repo/bare" + HOME = "repo/home" + WATCHERS = "repo/watchers" + FORKS = "repo/forks" ) func renderDirectory(ctx *context.Context, treeLink string) { @@ -304,7 +304,7 @@ func Home(ctx *context.Context) { ctx.HTML(200, HOME) } -func RenderUserCards(ctx *context.Context, total int, getter func(page int) ([]*models.User, error), tpl tool.TplName) { +func RenderUserCards(ctx *context.Context, total int, getter func(page int) ([]*models.User, error), tpl string) { page := ctx.QueryInt("page") if page <= 0 { page = 1 diff --git a/routers/repo/webhook.go b/routers/repo/webhook.go index d41ffa09..a0888877 100644 --- a/routers/repo/webhook.go +++ b/routers/repo/webhook.go @@ -16,16 +16,15 @@ import ( "github.com/gogits/gogs/models" "github.com/gogits/gogs/models/errors" - "github.com/gogits/gogs/pkg/tool" "github.com/gogits/gogs/pkg/context" "github.com/gogits/gogs/pkg/form" "github.com/gogits/gogs/pkg/setting" ) const ( - WEBHOOKS tool.TplName = "repo/settings/webhook/base" - WEBHOOK_NEW tool.TplName = "repo/settings/webhook/new" - ORG_WEBHOOK_NEW tool.TplName = "org/settings/webhook_new" + WEBHOOKS = "repo/settings/webhook/base" + WEBHOOK_NEW = "repo/settings/webhook/new" + ORG_WEBHOOK_NEW = "org/settings/webhook_new" ) func Webhooks(ctx *context.Context) { @@ -49,7 +48,7 @@ type OrgRepoCtx struct { OrgID int64 RepoID int64 Link string - NewTemplate tool.TplName + NewTemplate string } // getOrgRepoCtx determines whether this is a repo context or organization context. diff --git a/routers/repo/wiki.go b/routers/repo/wiki.go index fbaccfe5..bea4628c 100644 --- a/routers/repo/wiki.go +++ b/routers/repo/wiki.go @@ -12,17 +12,16 @@ import ( "github.com/gogits/git-module" "github.com/gogits/gogs/models" - "github.com/gogits/gogs/pkg/tool" "github.com/gogits/gogs/pkg/context" "github.com/gogits/gogs/pkg/form" "github.com/gogits/gogs/pkg/markup" ) const ( - WIKI_START tool.TplName = "repo/wiki/start" - WIKI_VIEW tool.TplName = "repo/wiki/view" - WIKI_NEW tool.TplName = "repo/wiki/new" - WIKI_PAGES tool.TplName = "repo/wiki/pages" + WIKI_START = "repo/wiki/start" + WIKI_VIEW = "repo/wiki/view" + WIKI_NEW = "repo/wiki/new" + WIKI_PAGES = "repo/wiki/pages" ) func MustEnableWiki(ctx *context.Context) { |