Skip to content

Commit

Permalink
Fixed edit template
Browse files Browse the repository at this point in the history
  • Loading branch information
thewhitetulip committed Nov 22, 2015
1 parent 86d31de commit a6cc40e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
7 changes: 5 additions & 2 deletions db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 4 additions & 1 deletion public/templates/_head.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<title>{{if eq .Navigation "pending"}} Tasks
{{ else if eq .Navigation "completed"}}Completed
{{ else if eq .Navigation "deleted"}}Deleted
{{ else if eq .Navigation "edit"}} Edit
{{end}}
</title>

Expand Down Expand Up @@ -41,16 +42,18 @@
</head>
<body>
<!-- The navigation bar-->
<div class="notification" {{if eq .Message ""}} class="hidden" {{end}}><span id="message">{{.Message}}</span> <button class="notification-close" type="button">&times;</button></div>
<nav class="navbar navbar-default navbar-fixed-top mainHeader">
<div class="container-fluid">
<div class="navbar-header">
{{if .Search}} <a class="navbar-brand"> Results for: {{.Search}}</a>
{{else}}
<a class="navbar-brand"
href='{{ if eq .Navigation "pending"}} / {{else}} /{{.Navigation}} {{end}}'>
{{if eq .Navigation "pending"}} Tasks
{{if eq .Navigation "pending"}} Pending
{{ else if eq .Navigation "completed"}}Completed
{{ else if eq .Navigation "deleted"}}Deleted
{{ else if eq .Navigation "edit"}} Edit
{{end}}</a>
{{end}}
<span id="icons">
Expand Down
8 changes: 3 additions & 5 deletions public/templates/edit.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{template "_head.html"}}
{{template "_head.html" .}}
<div class="timeline">
{{ if .}}
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="newNoteLabel"><span class="glyphicon glyphicon-pencil"></span> Edit Task</h4>
</div>
{{range .Tasks}}
<div class="modal-body">
<form action="/update/" method="POST">
<div class="form-group">
Expand All @@ -23,10 +23,8 @@ <h4 class="modal-title" id="newNoteLabel"><span class="glyphicon glyphicon-penci
</div>
</form>
</div>
{{else}}
<p>No tasks here</p>
{{end}}
</div>
{{end}}
{{template "_footer.gtpl"}}

</body>
Expand Down

0 comments on commit a6cc40e

Please sign in to comment.