Fixed edit template

This commit is contained in:
thewhitetulip 2015-11-22 08:29:39 +05:30
parent 86d31dea5d
commit a6cc40e7d2
3 changed files with 12 additions and 8 deletions

View File

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

View File

@ -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>
@ -41,6 +42,7 @@
</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">
@ -48,9 +50,10 @@
{{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">

View File

@ -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">
@ -23,10 +23,8 @@
</div>
</form>
</div>
{{else}}
<p>No tasks here</p>
{{end}}
</div>
{{end}}
{{template "_footer.gtpl"}}
</body>