summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-03-06 16:40:04 -0500
committerUnknwon <u@gogs.io>2016-03-06 16:40:04 -0500
commit58f0c68151d40009800eca138d52c29cac0410e8 (patch)
tree919d0ede05761f194749d2b953f890aa947d4715
parent12b5a76b0d528a6b4159894204163ce16f4c247a (diff)
downloadgitea-58f0c68151d40009800eca138d52c29cac0410e8.tar.gz
gitea-58f0c68151d40009800eca138d52c29cac0410e8.zip
Some minor changes
-rw-r--r--.bra.toml1
-rw-r--r--.gitignore21
-rw-r--r--Makefile6
-rw-r--r--cmd/web.go3
-rw-r--r--conf/README.md6
-rw-r--r--modules/template/template.go160
6 files changed, 90 insertions, 107 deletions
diff --git a/.bra.toml b/.bra.toml
index c4b1885d58..a25a22410f 100644
--- a/.bra.toml
+++ b/.bra.toml
@@ -1,6 +1,5 @@
[run]
init_cmds = [
- #["grep", "-rn", "FIXME", "."],
["make", "build-dev", "TAGS=sqlite"],
["./gogs", "web"]
]
diff --git a/.gitignore b/.gitignore
index 9d6db3d68f..f7fd3ace29 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,31 +8,12 @@ data/
.idea/
*.iml
public/img/avatar/
-files/
-*.o
-*.a
-*.so
-_obj
-_test
-[568vq].out
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-_testmain.go
*.exe
*.exe~
/gogs
profile/
-__pycache__
*.pem
output*
-.brackets.json
-docker/fig.yml
-docker/docker/Dockerfile
-docker/docker/init_gogs.sh
gogs.sublime-project
gogs.sublime-workspace
-.tags*
-release
+/release
diff --git a/Makefile b/Makefile
index 8ba1aa7ae5..d1be2bbc8f 100644
--- a/Makefile
+++ b/Makefile
@@ -53,3 +53,9 @@ clean-mac: clean
test:
go test -cover -race ./...
+
+fixme:
+ grep -rnw "FIXME" routers models modules
+
+todo:
+ grep -rnw "TODO" routers models modules
diff --git a/cmd/web.go b/cmd/web.go
index 82cde7b474..ec2486acbe 100644
--- a/cmd/web.go
+++ b/cmd/web.go
@@ -7,7 +7,6 @@ package cmd
import (
"crypto/tls"
"fmt"
- gotmpl "html/template"
"io/ioutil"
"net/http"
"net/http/fcgi"
@@ -126,7 +125,7 @@ func newMacaron() *macaron.Macaron {
))
m.Use(macaron.Renderer(macaron.RenderOptions{
Directory: path.Join(setting.StaticRootPath, "templates"),
- Funcs: []gotmpl.FuncMap{template.Funcs},
+ Funcs: template.NewFuncMap(),
IndentJSON: macaron.Env != macaron.PROD,
}))
diff --git a/conf/README.md b/conf/README.md
index 058b46f4d4..ee197505aa 100644
--- a/conf/README.md
+++ b/conf/README.md
@@ -1,7 +1,3 @@
Execute following command in ROOT directory when anything is changed:
-$ go-bindata -o=modules/bindata/bindata.go -ignore="\\.DS_Store|README.md" -pkg=bindata conf/...
-
-Add -debug flag to make life easier in development(somehow isn't working):
-
-$ go-bindata -debug -o=modules/bindata/bindata.go -ignore="\\.DS_Store|README.md" -pkg=bindata conf/... \ No newline at end of file
+$ make bindata \ No newline at end of file
diff --git a/modules/template/template.go b/modules/template/template.go
index da7f20c585..79b3f83565 100644
--- a/modules/template/template.go
+++ b/modules/template/template.go
@@ -22,86 +22,88 @@ import (
"github.com/gogits/gogs/modules/setting"
)
-var Funcs template.FuncMap = map[string]interface{}{
- "GoVer": func() string {
- return strings.Title(runtime.Version())
- },
- "UseHTTPS": func() bool {
- return strings.HasPrefix(setting.AppUrl, "https")
- },
- "AppName": func() string {
- return setting.AppName
- },
- "AppSubUrl": func() string {
- return setting.AppSubUrl
- },
- "AppUrl": func() string {
- return setting.AppUrl
- },
- "AppVer": func() string {
- return setting.AppVer
- },
- "AppDomain": func() string {
- return setting.Domain
- },
- "DisableGravatar": func() bool {
- return setting.DisableGravatar
- },
- "LoadTimes": func(startTime time.Time) string {
- return fmt.Sprint(time.Since(startTime).Nanoseconds()/1e6) + "ms"
- },
- "AvatarLink": base.AvatarLink,
- "Safe": Safe,
- "Str2html": Str2html,
- "TimeSince": base.TimeSince,
- "RawTimeSince": base.RawTimeSince,
- "FileSize": base.FileSize,
- "Subtract": base.Subtract,
- "Add": func(a, b int) int {
- return a + b
- },
- "ActionIcon": ActionIcon,
- "DateFmtLong": func(t time.Time) string {
- return t.Format(time.RFC1123Z)
- },
- "DateFmtShort": func(t time.Time) string {
- return t.Format("Jan 02, 2006")
- },
- "List": List,
- "Mail2Domain": func(mail string) string {
- if !strings.Contains(mail, "@") {
- return "try.gogs.io"
- }
+func NewFuncMap() []template.FuncMap {
+ return []template.FuncMap{map[string]interface{}{
+ "GoVer": func() string {
+ return strings.Title(runtime.Version())
+ },
+ "UseHTTPS": func() bool {
+ return strings.HasPrefix(setting.AppUrl, "https")
+ },
+ "AppName": func() string {
+ return setting.AppName
+ },
+ "AppSubUrl": func() string {
+ return setting.AppSubUrl
+ },
+ "AppUrl": func() string {
+ return setting.AppUrl
+ },
+ "AppVer": func() string {
+ return setting.AppVer
+ },
+ "AppDomain": func() string {
+ return setting.Domain
+ },
+ "DisableGravatar": func() bool {
+ return setting.DisableGravatar
+ },
+ "LoadTimes": func(startTime time.Time) string {
+ return fmt.Sprint(time.Since(startTime).Nanoseconds()/1e6) + "ms"
+ },
+ "AvatarLink": base.AvatarLink,
+ "Safe": Safe,
+ "Str2html": Str2html,
+ "TimeSince": base.TimeSince,
+ "RawTimeSince": base.RawTimeSince,
+ "FileSize": base.FileSize,
+ "Subtract": base.Subtract,
+ "Add": func(a, b int) int {
+ return a + b
+ },
+ "ActionIcon": ActionIcon,
+ "DateFmtLong": func(t time.Time) string {
+ return t.Format(time.RFC1123Z)
+ },
+ "DateFmtShort": func(t time.Time) string {
+ return t.Format("Jan 02, 2006")
+ },
+ "List": List,
+ "Mail2Domain": func(mail string) string {
+ if !strings.Contains(mail, "@") {
+ return "try.gogs.io"
+ }
- return strings.SplitN(mail, "@", 2)[1]
- },
- "SubStr": func(str string, start, length int) string {
- if len(str) == 0 {
- return ""
- }
- end := start + length
- if length == -1 {
- end = len(str)
- }
- if len(str) < end {
- return str
- }
- return str[start:end]
- },
- "DiffTypeToStr": DiffTypeToStr,
- "DiffLineTypeToStr": DiffLineTypeToStr,
- "Sha1": Sha1,
- "ShortSha": base.ShortSha,
- "MD5": base.EncodeMD5,
- "ActionContent2Commits": ActionContent2Commits,
- "ToUtf8": ToUtf8,
- "EscapePound": func(str string) string {
- return strings.Replace(strings.Replace(str, "%", "%25", -1), "#", "%23", -1)
- },
- "RenderCommitMessage": RenderCommitMessage,
- "ThemeColorMetaTag": func() string {
- return setting.ThemeColorMetaTag
- },
+ return strings.SplitN(mail, "@", 2)[1]
+ },
+ "SubStr": func(str string, start, length int) string {
+ if len(str) == 0 {
+ return ""
+ }
+ end := start + length
+ if length == -1 {
+ end = len(str)
+ }
+ if len(str) < end {
+ return str
+ }
+ return str[start:end]
+ },
+ "DiffTypeToStr": DiffTypeToStr,
+ "DiffLineTypeToStr": DiffLineTypeToStr,
+ "Sha1": Sha1,
+ "ShortSha": base.ShortSha,
+ "MD5": base.EncodeMD5,
+ "ActionContent2Commits": ActionContent2Commits,
+ "ToUtf8": ToUtf8,
+ "EscapePound": func(str string) string {
+ return strings.Replace(strings.Replace(str, "%", "%25", -1), "#", "%23", -1)
+ },
+ "RenderCommitMessage": RenderCommitMessage,
+ "ThemeColorMetaTag": func() string {
+ return setting.ThemeColorMetaTag
+ },
+ }}
}
func Safe(raw string) template.HTML {