From a6cc40e7d29cb9b7d7ec654723d3285b88e1c680 Mon Sep 17 00:00:00 2001 From: thewhitetulip Date: Sun, 22 Nov 2015 08:29:39 +0530 Subject: [PATCH] Fixed edit template --- db/db.go | 7 +++++-- public/templates/_head.html | 5 ++++- public/templates/edit.html | 8 +++----- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/db/db.go b/db/db.go index 1cab581..1907148 100644 --- a/db/db.go +++ b/db/db.go @@ -63,7 +63,8 @@ func GetTasks(status string) types.Context { } //GetTaskByID function gets the tasks from the ID passed to the function -func GetTaskByID(id int) types.Task { +func GetTaskByID(id int) types.Context { + var tasks []types.Task var task types.Task var TaskID int var TaskTitle string @@ -82,7 +83,9 @@ func GetTaskByID(id int) types.Task { } task = types.Task{Id: TaskID, Title: TaskTitle, Content: TaskContent} } - return task + tasks = append(tasks, task) + context := types.Context{Tasks: tasks, Navigation: "edit"} + return context } //TrashTask is used to delete the task diff --git a/public/templates/_head.html b/public/templates/_head.html index 1e0792e..fb6d402 100755 --- a/public/templates/_head.html +++ b/public/templates/_head.html @@ -7,6 +7,7 @@ {{if eq .Navigation "pending"}} Tasks {{ else if eq .Navigation "completed"}}Completed {{ else if eq .Navigation "deleted"}}Deleted + {{ else if eq .Navigation "edit"}} Edit {{end}} @@ -41,6 +42,7 @@ +
{{.Message}}