aboutsummaryrefslogtreecommitdiff
path: root/pkg/context
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-04-05 09:17:21 -0400
committerUnknwon <u@gogs.io>2017-04-05 09:17:21 -0400
commitedaf14f2b6fd86f8dec99f67512a5c0095e391dc (patch)
treeec81011348a0c8df3995c36b46e2646472106800 /pkg/context
parent6fbb984ebf4f0d6804f0f83e6edb12ef0bb9a570 (diff)
Refactoring: remove tool.TplName
Diffstat (limited to 'pkg/context')
-rw-r--r--pkg/context/api.go6
-rw-r--r--pkg/context/context.go11
2 files changed, 9 insertions, 8 deletions
diff --git a/pkg/context/api.go b/pkg/context/api.go
index 5e29a73f..ffaddd33 100644
--- a/pkg/context/api.go
+++ b/pkg/context/api.go
@@ -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,
})
}
diff --git a/pkg/context/context.go b/pkg/context/context.go
index 89783007..4213eaa4 100644
--- a/pkg/context/context.go
+++ b/pkg/context/context.go
@@ -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.