2015-11-13 14:34:42 +05:30
|
|
|
package types
|
|
|
|
|
2016-12-20 21:42:22 +05:30
|
|
|
import "html/template"
|
|
|
|
|
2016-02-01 20:04:19 +05:30
|
|
|
/*
|
|
|
|
Package types is used to store the context struct which
|
|
|
|
is passed while templates are executed.
|
|
|
|
*/
|
2015-11-21 18:50:51 +05:30
|
|
|
//Task is the struct used to identify tasks
|
2015-11-13 14:34:42 +05:30
|
|
|
type Task struct {
|
2016-12-20 21:42:22 +05:30
|
|
|
Id int `json:"id"`
|
|
|
|
Title string `json:"title"`
|
|
|
|
Content string `json:"content"`
|
|
|
|
ContentHTML template.HTML `json:"content_html"`
|
|
|
|
Created string `json:"created"`
|
|
|
|
Priority string `json:"priority"`
|
|
|
|
Category string `json:"category"`
|
|
|
|
Referer string `json:"referer,omitempty"`
|
|
|
|
Comments []Comment `json:"comments,omitempty"`
|
2018-09-05 11:13:53 +08:00
|
|
|
IsOverdue bool `json:"isoverdue,omitempty"`
|
|
|
|
IsHidden int `json:"ishidden,omitempty`
|
|
|
|
CompletedMsg string `json:"ishidden,omitempty"`
|
2016-02-14 23:16:22 +05:30
|
|
|
}
|
|
|
|
|
2016-05-22 15:10:55 +05:30
|
|
|
type Tasks []Task
|
|
|
|
|
2016-02-14 23:16:22 +05:30
|
|
|
//Comment is the struct used to populate comments per tasks
|
|
|
|
type Comment struct {
|
2016-05-22 15:10:55 +05:30
|
|
|
ID int `json:"id"`
|
|
|
|
Content string `json:"content"`
|
|
|
|
Created string `json:"created_date"`
|
|
|
|
Username string `json:"username"`
|
2015-11-13 14:34:42 +05:30
|
|
|
}
|
2015-11-21 18:50:51 +05:30
|
|
|
|
|
|
|
//Context is the struct passed to templates
|
|
|
|
type Context struct {
|
|
|
|
Tasks []Task
|
|
|
|
Navigation string
|
2015-11-21 19:42:44 +05:30
|
|
|
Search string
|
2015-11-22 09:21:29 +05:30
|
|
|
Message string
|
2016-01-18 06:32:15 +05:30
|
|
|
CSRFToken string
|
2016-02-05 01:09:36 +05:30
|
|
|
Categories []CategoryCount
|
2016-02-06 15:32:46 +05:30
|
|
|
Referer string
|
2016-02-05 01:09:36 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
//CategoryCount is the struct used to populate the sidebar
|
|
|
|
//which contains the category name and the count of the tasks
|
|
|
|
//in each category
|
|
|
|
type CategoryCount struct {
|
|
|
|
Name string
|
|
|
|
Count int
|
2015-11-21 18:50:51 +05:30
|
|
|
}
|
2016-05-22 15:10:55 +05:30
|
|
|
|
|
|
|
//Status is the JSON struct to be returned
|
|
|
|
type Status struct {
|
|
|
|
StatusCode int `json:"status_code"`
|
|
|
|
Message string `json:"message"`
|
|
|
|
}
|
|
|
|
|
|
|
|
//Category is the structure of the category table
|
|
|
|
type Category struct {
|
|
|
|
ID int `json:"category_id"`
|
|
|
|
Name string `json:"category_name"`
|
|
|
|
Created string `json:"created_date"`
|
|
|
|
}
|
|
|
|
|
|
|
|
//Categories will show
|
|
|
|
type Categories []Category
|