diff --git a/db/tasks.go b/db/tasks.go index 45b4b67..8e9147d 100644 --- a/db/tasks.go +++ b/db/tasks.go @@ -118,6 +118,12 @@ func GetTasks(status, category string) (types.Context, error) { } TaskCreated = TaskCreated.Local() + CurrentTime := time.Now().Local() + week := TaskCreated.AddDate(0, 0, 7) + + if (week.String() < CurrentTime.String()) && (task.Priority != "1") { + task.IsOverdue = true // If one week then overdue by default + } task.Created = TaskCreated.Format("Jan 01 2006") tasks = append(tasks, task) @@ -266,6 +272,12 @@ func SearchTask(query string) types.Context { task.Content = string(md.Markdown([]byte(task.Content))) TaskCreated = TaskCreated.Local() + CurrentTime := time.Now().Local() + week := TaskCreated.AddDate(0, 0, 7) + + if (week.String() < CurrentTime.String()) && (task.Priority != "1") { + task.IsOverdue = true // If one week then overdue by default + } task.Created = TaskCreated.Format("Jan 01 2006") tasks = append(tasks, task) diff --git a/public/static/css/styles.css b/public/static/css/styles.css index 5a8a990..187fb70 100644 --- a/public/static/css/styles.css +++ b/public/static/css/styles.css @@ -146,10 +146,19 @@ nav .glyphicon:hover{ /*-------------------------------------- NotesFeed -------------------------------------- */ +.overdue { + color: red; + margin-top: 1px; + font-size: 12px; + padding-top: -100px; + position: absolute; + padding-left: 5px; +} + .noteHeading { font-weight:900; font-size:17px; - color:#666666; + color:#666666; margin-bottom:0px; padding-bottom:5px; } diff --git a/templates/home.html b/templates/home.html index 5ccb1c8..8dc1d00 100644 --- a/templates/home.html +++ b/templates/home.html @@ -50,7 +50,9 @@
{{ if .Tasks}} {{range $key, $value := .Tasks}}
-

{{ $value.Title}}

+

{{ $value.Title}} + {{if $value.IsOverdue}}Overdue{{end}} +

{{$value.Content}} diff --git a/templates/search.html b/templates/search.html index e7655ae..4e41af9 100644 --- a/templates/search.html +++ b/templates/search.html @@ -3,7 +3,7 @@
{{ if .Tasks}} {{range $key, $value := .Tasks}}
-

{{ $value.Title}}

+

{{ $value.Title}}{{if $value.IsOverdue}}Overdue{{end}}

{{$value.Content}} diff --git a/types/types.go b/types/types.go index 0a5c12d..72d04c6 100644 --- a/types/types.go +++ b/types/types.go @@ -6,14 +6,15 @@ is passed while templates are executed. */ //Task is the struct used to identify tasks type Task struct { - Id int - Title string - Content string - Created string - Priority string - Category string - Referer string - Comments []Comment + Id int + Title string + Content string + Created string + Priority string + Category string + Referer string + Comments []Comment + IsOverdue bool } //Comment is the struct used to populate comments per tasks