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 //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 task types.Task
var TaskID int var TaskID int
var TaskTitle string var TaskTitle string
@ -82,7 +83,9 @@ func GetTaskByID(id int) types.Task {
} }
task = types.Task{Id: TaskID, Title: TaskTitle, Content: TaskContent} 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 //TrashTask is used to delete the task

View File

@ -7,6 +7,7 @@
<title>{{if eq .Navigation "pending"}} Tasks <title>{{if eq .Navigation "pending"}} Tasks
{{ else if eq .Navigation "completed"}}Completed {{ else if eq .Navigation "completed"}}Completed
{{ else if eq .Navigation "deleted"}}Deleted {{ else if eq .Navigation "deleted"}}Deleted
{{ else if eq .Navigation "edit"}} Edit
{{end}} {{end}}
</title> </title>
@ -41,6 +42,7 @@
</head> </head>
<body> <body>
<!-- The navigation bar--> <!-- 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"> <nav class="navbar navbar-default navbar-fixed-top mainHeader">
<div class="container-fluid"> <div class="container-fluid">
<div class="navbar-header"> <div class="navbar-header">
@ -48,9 +50,10 @@
{{else}} {{else}}
<a class="navbar-brand" <a class="navbar-brand"
href='{{ if eq .Navigation "pending"}} / {{else}} /{{.Navigation}} {{end}}'> 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 "completed"}}Completed
{{ else if eq .Navigation "deleted"}}Deleted {{ else if eq .Navigation "deleted"}}Deleted
{{ else if eq .Navigation "edit"}} Edit
{{end}}</a> {{end}}</a>
{{end}} {{end}}
<span id="icons"> <span id="icons">

View File

@ -1,10 +1,10 @@
{{template "_head.html"}} {{template "_head.html" .}}
<div class="timeline"> <div class="timeline">
{{ if .}}
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title" id="newNoteLabel"><span class="glyphicon glyphicon-pencil"></span> Edit Task</h4> <h4 class="modal-title" id="newNoteLabel"><span class="glyphicon glyphicon-pencil"></span> Edit Task</h4>
</div> </div>
{{range .Tasks}}
<div class="modal-body"> <div class="modal-body">
<form action="/update/" method="POST"> <form action="/update/" method="POST">
<div class="form-group"> <div class="form-group">
@ -23,10 +23,8 @@
</div> </div>
</form> </form>
</div> </div>
{{else}}
<p>No tasks here</p>
{{end}}
</div> </div>
{{end}}
{{template "_footer.gtpl"}} {{template "_footer.gtpl"}}
</body> </body>