aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrtz12 <koenig@fagott.pw>2016-11-13 17:41:51 (UTC)
committerrtz12 <koenig@fagott.pw>2016-11-13 17:41:51 (UTC)
commit8912ea5bca857ac509e426286768feb788539628 (patch)
tree66c5916c9821c2b45f2e7b2d43544eeff1ed9426
parentfed8f628b428d8661bf917abd7ae98aa818b883d (diff)
parentaec3f635032120b0d5ca5ada7959d3f09b7fa94c (diff)
Merge branch 'master' of projekte.fagott.pw:grilist
-rw-r--r--frontend/renderer.go6
-rw-r--r--main.go4
-rw-r--r--modules/lists/lists.go2
-rw-r--r--views/pages/user.html2
4 files changed, 10 insertions, 4 deletions
diff --git a/frontend/renderer.go b/frontend/renderer.go
index 3fb79bf..d529dff 100644
--- a/frontend/renderer.go
+++ b/frontend/renderer.go
@@ -50,7 +50,7 @@ func (r *Renderer) SetDefaultData(data map[string]interface{}) {
50} 50}
51 51
52// New erstellt einen neuen Renderer und sucht alle Templates aus dem gegebenen pfad. 52// New erstellt einen neuen Renderer und sucht alle Templates aus dem gegebenen pfad.
53func New(path string) *Renderer { 53func New(path string, functions map[string]interface{}) *Renderer {
54 // Custom Template Funcs 54 // Custom Template Funcs
55 funcMap := template.FuncMap{ 55 funcMap := template.FuncMap{
56 "html": func(in string) template.HTML { 56 "html": func(in string) template.HTML {
@@ -73,6 +73,10 @@ func New(path string) *Renderer {
73 }, 73 },
74 } 74 }
75 75
76 for k, v := range functions {
77 funcMap[k] = v
78 }
79
76 files := make([]string, 0) 80 files := make([]string, 0)
77 filepath.Walk(path, func(path string, info os.FileInfo, err error) error { 81 filepath.Walk(path, func(path string, info os.FileInfo, err error) error {
78 if info.IsDir() || !strings.HasSuffix(path, ".html") { 82 if info.IsDir() || !strings.HasSuffix(path, ".html") {
diff --git a/main.go b/main.go
index 240ca1a..dd00a9b 100644
--- a/main.go
+++ b/main.go
@@ -63,7 +63,9 @@ func main() {
63 } 63 }
64 } 64 }
65 65
66 renderer := frontend.New("views") 66 functions := charakterin.GetRendererFunctions()
67
68 renderer := frontend.New("views", functions)
67 login := charakterin.New(db) 69 login := charakterin.New(db)
68 login.UseRenderer(renderer) 70 login.UseRenderer(renderer)
69 if config.AnilistAPI.ClientID != "" && config.AnilistAPI.ClientSecret != "" { 71 if config.AnilistAPI.ClientID != "" && config.AnilistAPI.ClientSecret != "" {
diff --git a/modules/lists/lists.go b/modules/lists/lists.go
index be6e399..c287dc5 100644
--- a/modules/lists/lists.go
+++ b/modules/lists/lists.go
@@ -200,7 +200,7 @@ func ListsToCards(lists []*models.List) []frontend.Card {
200 Link: fmt.Sprintf("/list/%d", list.ID), 200 Link: fmt.Sprintf("/list/%d", list.ID),
201 }, 201 },
202 frontend.Action{ 202 frontend.Action{
203 Name: fmt.Sprintf(`<span class="chip">von <a class="purple-text text-lighten-2" style="margin-right: 0px" href="/user/%d/%s">%s</a></span>`, list.Owner.ID, list.Owner.GetName(), list.Owner.GetName()), 203 Name: fmt.Sprintf(`<span class="chip" style="white-space: nowrap">von <a class="purple-text text-lighten-2" style="margin-right: 0px" href="/user/%d/%s">%s</a></span>`, list.Owner.ID, list.Owner.GetName(), list.Owner.GetName()),
204 Link: "#", 204 Link: "#",
205 Disabled: true, 205 Disabled: true,
206 }, 206 },
diff --git a/views/pages/user.html b/views/pages/user.html
index 3c9d145..66cd62d 100644
--- a/views/pages/user.html
+++ b/views/pages/user.html
@@ -1,5 +1,5 @@
1{{ define "user" }} 1{{ define "user" }}
2{{ $isCurrentUser := (and .user (eq .DisplayUser.ID .user.ID)) }} 2{{ $isCurrentUser := isSameUser .DisplayUser .user }}
3<html> 3<html>
4 <head> 4 <head>
5 {{ template "materialize" }} 5 {{ template "materialize" }}