text-template to html-template

This commit is contained in:
Suraj Patil 2016-12-20 22:03:29 +05:30
parent eb45ec612e
commit 0422eaed3b
4 changed files with 12 additions and 7 deletions

View File

@ -4,7 +4,7 @@
{{ if .Tasks}} {{range $key, $value := .Tasks}}
<div class="note">
<p class="noteHeading">{{$value.Title}}</p> <span class="toggle glyphicon glyphicon-resize-full"></span>
<span class="noteContent">{{$value.Content}}</span>
<span class="noteContent">{{$value.ContentHTML}}</span>
<span class="notefooter">
<ul class="menu">
<li role="presentation">Priority: {{$value.Priority}}</li>

View File

@ -39,7 +39,7 @@
</div>
{{end}}
</div>
{{template "footer.html"}}
{{template "_footer.html"}}
</body>

View File

@ -6,7 +6,7 @@
<p class="noteHeading">{{ $value.Title}}{{if $value.IsOverdue}}<span class="overdue">Overdue</span>{{end}}</p> <span class="toggle glyphicon glyphicon-resize-full"></span>
<span class="noteContent">
{{$value.Content}}
{{$value.ContentHTML}}
<div class="commentslist">
{{range $value.Comments}}
<div class="comment">

View File

@ -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)
}
}
}