mirror of https://github.com/gogs/gogs.git
Refactoring: remove tool.TplName
parent
6fbb984ebf
commit
edaf14f2b6
|
@ -12,7 +12,6 @@ import (
|
|||
log "gopkg.in/clog.v1"
|
||||
"gopkg.in/macaron.v1"
|
||||
|
||||
"github.com/gogits/gogs/pkg/tool"
|
||||
"github.com/gogits/gogs/pkg/setting"
|
||||
)
|
||||
|
||||
|
@ -21,6 +20,9 @@ type APIContext struct {
|
|||
Org *APIOrganization
|
||||
}
|
||||
|
||||
// FIXME: move to github.com/gogits/go-gogs-client
|
||||
const DOC_URL = "https://github.com/gogits/go-gogs-client/wiki"
|
||||
|
||||
// Error responses error message to client with given message.
|
||||
// If status is 500, also it prints error to log.
|
||||
func (ctx *APIContext) Error(status int, title string, obj interface{}) {
|
||||
|
@ -37,7 +39,7 @@ func (ctx *APIContext) Error(status int, title string, obj interface{}) {
|
|||
|
||||
ctx.JSON(status, map[string]string{
|
||||
"message": message,
|
||||
"url": tool.DOC_URL,
|
||||
"url": DOC_URL,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/pkg/auth"
|
||||
"github.com/gogits/gogs/pkg/tool"
|
||||
"github.com/gogits/gogs/pkg/form"
|
||||
"github.com/gogits/gogs/pkg/setting"
|
||||
)
|
||||
|
@ -80,18 +79,18 @@ func (ctx *Context) HasValue(name string) bool {
|
|||
}
|
||||
|
||||
// HTML responses template with given status.
|
||||
func (ctx *Context) HTML(status int, name tool.TplName) {
|
||||
func (ctx *Context) HTML(status int, name string) {
|
||||
log.Trace("Template: %s", name)
|
||||
ctx.Context.HTML(status, string(name))
|
||||
ctx.Context.HTML(status, name)
|
||||
}
|
||||
|
||||
// Success responses template with status http.StatusOK.
|
||||
func (c *Context) Success(name tool.TplName) {
|
||||
func (c *Context) Success(name string) {
|
||||
c.HTML(http.StatusOK, name)
|
||||
}
|
||||
|
||||
// RenderWithErr used for page has form validation but need to prompt error to users.
|
||||
func (ctx *Context) RenderWithErr(msg string, tpl tool.TplName, f interface{}) {
|
||||
func (ctx *Context) RenderWithErr(msg, tpl string, f interface{}) {
|
||||
if f != nil {
|
||||
form.Assign(f, ctx.Data)
|
||||
}
|
||||
|
@ -112,7 +111,7 @@ func (ctx *Context) Handle(status int, title string, err error) {
|
|||
ctx.Data["ErrorMsg"] = err
|
||||
}
|
||||
}
|
||||
ctx.HTML(status, tool.TplName(fmt.Sprintf("status/%d", status)))
|
||||
ctx.HTML(status, fmt.Sprintf("status/%d", status))
|
||||
}
|
||||
|
||||
// NotFound renders the 404 page.
|
||||
|
|
|
@ -12,21 +12,20 @@ import (
|
|||
"gopkg.in/gomail.v2"
|
||||
"gopkg.in/macaron.v1"
|
||||
|
||||
"github.com/gogits/gogs/pkg/tool"
|
||||
"github.com/gogits/gogs/pkg/markup"
|
||||
"github.com/gogits/gogs/pkg/setting"
|
||||
)
|
||||
|
||||
const (
|
||||
MAIL_AUTH_ACTIVATE tool.TplName = "auth/activate"
|
||||
MAIL_AUTH_ACTIVATE_EMAIL tool.TplName = "auth/activate_email"
|
||||
MAIL_AUTH_RESET_PASSWORD tool.TplName = "auth/reset_passwd"
|
||||
MAIL_AUTH_REGISTER_NOTIFY tool.TplName = "auth/register_notify"
|
||||
MAIL_AUTH_ACTIVATE = "auth/activate"
|
||||
MAIL_AUTH_ACTIVATE_EMAIL = "auth/activate_email"
|
||||
MAIL_AUTH_RESET_PASSWORD = "auth/reset_passwd"
|
||||
MAIL_AUTH_REGISTER_NOTIFY = "auth/register_notify"
|
||||
|
||||
MAIL_ISSUE_COMMENT tool.TplName = "issue/comment"
|
||||
MAIL_ISSUE_MENTION tool.TplName = "issue/mention"
|
||||
MAIL_ISSUE_COMMENT = "issue/comment"
|
||||
MAIL_ISSUE_MENTION = "issue/mention"
|
||||
|
||||
MAIL_NOTIFY_COLLABORATOR tool.TplName = "notify/collaborator"
|
||||
MAIL_NOTIFY_COLLABORATOR = "notify/collaborator"
|
||||
)
|
||||
|
||||
type MailRender interface {
|
||||
|
@ -79,7 +78,7 @@ type Issue interface {
|
|||
HTMLURL() string
|
||||
}
|
||||
|
||||
func SendUserMail(c *macaron.Context, u User, tpl tool.TplName, code, subject, info string) {
|
||||
func SendUserMail(c *macaron.Context, u User, tpl, code, subject, info string) {
|
||||
data := map[string]interface{}{
|
||||
"Username": u.DisplayName(),
|
||||
"ActiveCodeLives": setting.Service.ActiveCodeLives / 60,
|
||||
|
@ -172,12 +171,12 @@ func composeTplData(subject, body, link string) map[string]interface{} {
|
|||
return data
|
||||
}
|
||||
|
||||
func composeIssueMessage(issue Issue, repo Repository, doer User, tplName tool.TplName, tos []string, info string) *Message {
|
||||
func composeIssueMessage(issue Issue, repo Repository, doer User, tplName string, tos []string, info string) *Message {
|
||||
subject := issue.MailSubject()
|
||||
body := string(markup.RenderSpecialLink([]byte(issue.Content()), repo.HTMLURL(), repo.ComposeMetas()))
|
||||
data := composeTplData(subject, body, issue.HTMLURL())
|
||||
data["Doer"] = doer
|
||||
content, err := mailRender.HTMLString(string(tplName), data)
|
||||
content, err := mailRender.HTMLString(tplName, data)
|
||||
if err != nil {
|
||||
log.Error(3, "HTMLString (%s): %v", tplName, err)
|
||||
}
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package tool
|
||||
|
||||
const DOC_URL = "https://github.com/gogits/go-gogs-client/wiki"
|
||||
|
||||
type (
|
||||
TplName string
|
||||
)
|
|
@ -15,18 +15,18 @@ import (
|
|||
"gopkg.in/macaron.v1"
|
||||
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/pkg/tool"
|
||||
"github.com/gogits/gogs/pkg/context"
|
||||
"github.com/gogits/gogs/pkg/cron"
|
||||
"github.com/gogits/gogs/pkg/mailer"
|
||||
"github.com/gogits/gogs/pkg/process"
|
||||
"github.com/gogits/gogs/pkg/setting"
|
||||
"github.com/gogits/gogs/pkg/tool"
|
||||
)
|
||||
|
||||
const (
|
||||
DASHBOARD tool.TplName = "admin/dashboard"
|
||||
CONFIG tool.TplName = "admin/config"
|
||||
MONITOR tool.TplName = "admin/monitor"
|
||||
DASHBOARD = "admin/dashboard"
|
||||
CONFIG = "admin/config"
|
||||
MONITOR = "admin/monitor"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -13,16 +13,15 @@ import (
|
|||
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/pkg/auth/ldap"
|
||||
"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 (
|
||||
AUTHS tool.TplName = "admin/auth/list"
|
||||
AUTH_NEW tool.TplName = "admin/auth/new"
|
||||
AUTH_EDIT tool.TplName = "admin/auth/edit"
|
||||
AUTHS = "admin/auth/list"
|
||||
AUTH_NEW = "admin/auth/new"
|
||||
AUTH_EDIT = "admin/auth/edit"
|
||||
)
|
||||
|
||||
func Authentications(ctx *context.Context) {
|
||||
|
|
|
@ -10,13 +10,12 @@ 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/setting"
|
||||
)
|
||||
|
||||
const (
|
||||
NOTICES tool.TplName = "admin/notice"
|
||||
NOTICES = "admin/notice"
|
||||
)
|
||||
|
||||
func Notices(ctx *context.Context) {
|
||||
|
|
|
@ -6,14 +6,13 @@ package admin
|
|||
|
||||
import (
|
||||
"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/routers"
|
||||
)
|
||||
|
||||
const (
|
||||
ORGS tool.TplName = "admin/org/list"
|
||||
ORGS = "admin/org/list"
|
||||
)
|
||||
|
||||
func Organizations(ctx *context.Context) {
|
||||
|
|
|
@ -9,13 +9,12 @@ 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/setting"
|
||||
)
|
||||
|
||||
const (
|
||||
REPOS tool.TplName = "admin/repo/list"
|
||||
REPOS = "admin/repo/list"
|
||||
)
|
||||
|
||||
func Repos(ctx *context.Context) {
|
||||
|
|
|
@ -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/mailer"
|
||||
|
@ -20,9 +19,9 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
USERS tool.TplName = "admin/user/list"
|
||||
USER_NEW tool.TplName = "admin/user/new"
|
||||
USER_EDIT tool.TplName = "admin/user/edit"
|
||||
USERS = "admin/user/list"
|
||||
USER_NEW = "admin/user/new"
|
||||
USER_EDIT = "admin/user/edit"
|
||||
)
|
||||
|
||||
func Users(ctx *context.Context) {
|
||||
|
|
|
@ -6,7 +6,6 @@ package dev
|
|||
|
||||
import (
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/pkg/tool"
|
||||
"github.com/gogits/gogs/pkg/context"
|
||||
"github.com/gogits/gogs/pkg/setting"
|
||||
)
|
||||
|
@ -21,5 +20,5 @@ func TemplatePreview(ctx *context.Context) {
|
|||
ctx.Data["ResetPwdCodeLives"] = setting.Service.ResetPwdCodeLives / 60
|
||||
ctx.Data["CurDbValue"] = ""
|
||||
|
||||
ctx.HTML(200, tool.TplName(ctx.Params("*")))
|
||||
ctx.HTML(200, (ctx.Params("*")))
|
||||
}
|
||||
|
|
|
@ -8,17 +8,16 @@ import (
|
|||
"github.com/Unknwon/paginater"
|
||||
|
||||
"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/routers/user"
|
||||
)
|
||||
|
||||
const (
|
||||
HOME tool.TplName = "home"
|
||||
EXPLORE_REPOS tool.TplName = "explore/repos"
|
||||
EXPLORE_USERS tool.TplName = "explore/users"
|
||||
EXPLORE_ORGANIZATIONS tool.TplName = "explore/organizations"
|
||||
HOME = "home"
|
||||
EXPLORE_REPOS = "explore/repos"
|
||||
EXPLORE_USERS = "explore/users"
|
||||
EXPLORE_ORGANIZATIONS = "explore/organizations"
|
||||
)
|
||||
|
||||
func Home(ctx *context.Context) {
|
||||
|
@ -84,7 +83,7 @@ type UserSearchOptions struct {
|
|||
Ranger func(int, int) ([]*models.User, error)
|
||||
PageSize int
|
||||
OrderBy string
|
||||
TplName tool.TplName
|
||||
TplName string
|
||||
}
|
||||
|
||||
func RenderUserSearch(ctx *context.Context, opts *UserSearchOptions) {
|
||||
|
|
|
@ -21,7 +21,6 @@ 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/cron"
|
||||
"github.com/gogits/gogs/pkg/form"
|
||||
|
@ -30,11 +29,12 @@ import (
|
|||
"github.com/gogits/gogs/pkg/setting"
|
||||
"github.com/gogits/gogs/pkg/ssh"
|
||||
"github.com/gogits/gogs/pkg/template/highlight"
|
||||
"github.com/gogits/gogs/pkg/tool"
|
||||
"github.com/gogits/gogs/pkg/user"
|
||||
)
|
||||
|
||||
const (
|
||||
INSTALL tool.TplName = "install"
|
||||
INSTALL = "install"
|
||||
)
|
||||
|
||||
func checkRunMode() {
|
||||
|
|
|
@ -10,14 +10,13 @@ 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/setting"
|
||||
)
|
||||
|
||||
const (
|
||||
MEMBERS tool.TplName = "org/member/members"
|
||||
MEMBER_INVITE tool.TplName = "org/member/invite"
|
||||
MEMBERS = "org/member/members"
|
||||
MEMBER_INVITE = "org/member/invite"
|
||||
)
|
||||
|
||||
func Members(ctx *context.Context) {
|
||||
|
|
|
@ -8,14 +8,13 @@ import (
|
|||
log "gopkg.in/clog.v1"
|
||||
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/pkg/form"
|
||||
"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 (
|
||||
CREATE tool.TplName = "org/create"
|
||||
CREATE = "org/create"
|
||||
)
|
||||
|
||||
func Create(ctx *context.Context) {
|
||||
|
|
|
@ -11,7 +11,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/setting"
|
||||
|
@ -19,9 +18,9 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
SETTINGS_OPTIONS tool.TplName = "org/settings/options"
|
||||
SETTINGS_DELETE tool.TplName = "org/settings/delete"
|
||||
SETTINGS_WEBHOOKS tool.TplName = "org/settings/webhooks"
|
||||
SETTINGS_OPTIONS = "org/settings/options"
|
||||
SETTINGS_DELETE = "org/settings/delete"
|
||||
SETTINGS_WEBHOOKS = "org/settings/webhooks"
|
||||
)
|
||||
|
||||
func Settings(ctx *context.Context) {
|
||||
|
|
|
@ -12,16 +12,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"
|
||||
)
|
||||
|
||||
const (
|
||||
TEAMS tool.TplName = "org/team/teams"
|
||||
TEAM_NEW tool.TplName = "org/team/new"
|
||||
TEAM_MEMBERS tool.TplName = "org/team/members"
|
||||
TEAM_REPOSITORIES tool.TplName = "org/team/repositories"
|
||||
TEAMS = "org/team/teams"
|
||||
TEAM_NEW = "org/team/new"
|
||||
TEAM_MEMBERS = "org/team/members"
|
||||
TEAM_REPOSITORIES = "org/team/repositories"
|
||||
)
|
||||
|
||||
func Teams(ctx *context.Context) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -13,7 +13,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"
|
||||
|
@ -21,11 +20,11 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
SIGNIN tool.TplName = "user/auth/signin"
|
||||
SIGNUP tool.TplName = "user/auth/signup"
|
||||
ACTIVATE tool.TplName = "user/auth/activate"
|
||||
FORGOT_PASSWORD tool.TplName = "user/auth/forgot_passwd"
|
||||
RESET_PASSWORD tool.TplName = "user/auth/reset_passwd"
|
||||
SIGNIN = "user/auth/signin"
|
||||
SIGNUP = "user/auth/signup"
|
||||
ACTIVATE = "user/auth/activate"
|
||||
FORGOT_PASSWORD = "user/auth/forgot_passwd"
|
||||
RESET_PASSWORD = "user/auth/reset_passwd"
|
||||
)
|
||||
|
||||
// AutoSignIn reads cookie and try to auto-login.
|
||||
|
|
|
@ -13,17 +13,16 @@ 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/setting"
|
||||
)
|
||||
|
||||
const (
|
||||
DASHBOARD tool.TplName = "user/dashboard/dashboard"
|
||||
NEWS_FEED tool.TplName = "user/dashboard/feeds"
|
||||
ISSUES tool.TplName = "user/dashboard/issues"
|
||||
PROFILE tool.TplName = "user/profile"
|
||||
ORG_HOME tool.TplName = "org/home"
|
||||
DASHBOARD = "user/dashboard/dashboard"
|
||||
NEWS_FEED = "user/dashboard/feeds"
|
||||
ISSUES = "user/dashboard/issues"
|
||||
PROFILE = "user/profile"
|
||||
ORG_HOME = "org/home"
|
||||
)
|
||||
|
||||
// getDashboardContextUser finds out dashboard is viewing as which context user.
|
||||
|
|
|
@ -13,15 +13,14 @@ 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/setting"
|
||||
"github.com/gogits/gogs/routers/repo"
|
||||
)
|
||||
|
||||
const (
|
||||
FOLLOWERS tool.TplName = "user/meta/followers"
|
||||
STARS tool.TplName = "user/meta/stars"
|
||||
FOLLOWERS = "user/meta/followers"
|
||||
STARS = "user/meta/stars"
|
||||
)
|
||||
|
||||
func GetUserByName(ctx *context.Context, name string) *models.User {
|
||||
|
|
|
@ -14,25 +14,25 @@ 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"
|
||||
"github.com/gogits/gogs/pkg/setting"
|
||||
"github.com/gogits/gogs/pkg/tool"
|
||||
)
|
||||
|
||||
const (
|
||||
SETTINGS_PROFILE tool.TplName = "user/settings/profile"
|
||||
SETTINGS_AVATAR tool.TplName = "user/settings/avatar"
|
||||
SETTINGS_PASSWORD tool.TplName = "user/settings/password"
|
||||
SETTINGS_EMAILS tool.TplName = "user/settings/email"
|
||||
SETTINGS_SSH_KEYS tool.TplName = "user/settings/sshkeys"
|
||||
SETTINGS_SECURITY tool.TplName = "user/settings/security"
|
||||
SETTINGS_REPOSITORIES tool.TplName = "user/settings/repositories"
|
||||
SETTINGS_ORGANIZATIONS tool.TplName = "user/settings/organizations"
|
||||
SETTINGS_APPLICATIONS tool.TplName = "user/settings/applications"
|
||||
SETTINGS_DELETE tool.TplName = "user/settings/delete"
|
||||
NOTIFICATION tool.TplName = "user/notification"
|
||||
SETTINGS_PROFILE = "user/settings/profile"
|
||||
SETTINGS_AVATAR = "user/settings/avatar"
|
||||
SETTINGS_PASSWORD = "user/settings/password"
|
||||
SETTINGS_EMAILS = "user/settings/email"
|
||||
SETTINGS_SSH_KEYS = "user/settings/sshkeys"
|
||||
SETTINGS_SECURITY = "user/settings/security"
|
||||
SETTINGS_REPOSITORIES = "user/settings/repositories"
|
||||
SETTINGS_ORGANIZATIONS = "user/settings/organizations"
|
||||
SETTINGS_APPLICATIONS = "user/settings/applications"
|
||||
SETTINGS_DELETE = "user/settings/delete"
|
||||
NOTIFICATION = "user/notification"
|
||||
)
|
||||
|
||||
func Settings(c *context.Context) {
|
||||
|
|
Loading…
Reference in New Issue