From 0422eaed3b61474561b46091887ddb3da060efd4 Mon Sep 17 00:00:00 2001 From: Suraj Patil Date: Tue, 20 Dec 2016 22:03:29 +0530 Subject: [PATCH] text-template to html-template --- templates/completed.html | 4 ++-- templates/deleted.html | 4 ++-- templates/search.html | 4 ++-- views/views.go | 7 ++++++- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/templates/completed.html b/templates/completed.html index dd56de5..0d8774f 100644 --- a/templates/completed.html +++ b/templates/completed.html @@ -4,7 +4,7 @@ {{ if .Tasks}} {{range $key, $value := .Tasks}}

{{$value.Title}}

- {{$value.Content}} + {{$value.ContentHTML}}
{{end}} -{{template "footer.html"}} +{{template "_footer.html"}} - \ No newline at end of file + diff --git a/templates/search.html b/templates/search.html index 4e41af9..5edfa4b 100644 --- a/templates/search.html +++ b/templates/search.html @@ -6,7 +6,7 @@

{{ $value.Title}}{{if $value.IsOverdue}}Overdue{{end}}

- {{$value.Content}} + {{$value.ContentHTML}}
{{range $value.Comments}}
@@ -69,4 +69,4 @@ - \ No newline at end of file + diff --git a/views/views.go b/views/views.go index 52b773d..2c189a8 100644 --- a/views/views.go +++ b/views/views.go @@ -4,6 +4,7 @@ package views import ( "html/template" + "log" "net/http" "time" @@ -28,6 +29,7 @@ func ShowAllTasksFunc(w http.ResponseWriter, r *http.Request) { if r.Method == "GET" { username := sessions.GetCurrentUserName(r) context, err := db.GetTasks(username, "pending", "") + log.Println(context) categories := db.GetCategories(username) if err != nil { http.Redirect(w, r, "/", http.StatusInternalServerError) @@ -60,7 +62,10 @@ func ShowTrashTaskFunc(w http.ResponseWriter, r *http.Request) { context.Message = message message = "" } - deletedTemplate.Execute(w, context) + err = deletedTemplate.Execute(w, context) + if err != nil { + log.Fatal(err) + } } }