concept of overdue tasks

This commit is contained in:
Suraj 2016-02-29 23:56:41 +05:30
parent fa271dfaeb
commit 7a0b369dcb
5 changed files with 35 additions and 11 deletions

View File

@ -118,6 +118,12 @@ func GetTasks(status, category string) (types.Context, error) {
} }
TaskCreated = TaskCreated.Local() 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") task.Created = TaskCreated.Format("Jan 01 2006")
tasks = append(tasks, task) tasks = append(tasks, task)
@ -266,6 +272,12 @@ func SearchTask(query string) types.Context {
task.Content = string(md.Markdown([]byte(task.Content))) task.Content = string(md.Markdown([]byte(task.Content)))
TaskCreated = TaskCreated.Local() 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") task.Created = TaskCreated.Format("Jan 01 2006")
tasks = append(tasks, task) tasks = append(tasks, task)

View File

@ -146,6 +146,15 @@ nav .glyphicon:hover{
/*-------------------------------------- /*--------------------------------------
NotesFeed NotesFeed
-------------------------------------- */ -------------------------------------- */
.overdue {
color: red;
margin-top: 1px;
font-size: 12px;
padding-top: -100px;
position: absolute;
padding-left: 5px;
}
.noteHeading { .noteHeading {
font-weight:900; font-weight:900;
font-size:17px; font-size:17px;

View File

@ -50,7 +50,9 @@
<div class="timeline"> <div class="timeline">
{{ if .Tasks}} {{range $key, $value := .Tasks}} {{ if .Tasks}} {{range $key, $value := .Tasks}}
<div class="note" id="{{$value.Id}}"> <div class="note" id="{{$value.Id}}">
<p class="noteHeading">{{ $value.Title}}</p> <span class="toggle glyphicon glyphicon-resize-full"></span> <p class="noteHeading ">{{ $value.Title}}
{{if $value.IsOverdue}}<span class="overdue">Overdue</span>{{end}}
</p> <span class="toggle glyphicon glyphicon-resize-full"></span>
<span class="noteContent"> <span class="noteContent">
{{$value.Content}} {{$value.Content}}

View File

@ -3,7 +3,7 @@
<div class="timeline"> <div class="timeline">
{{ if .Tasks}} {{range $key, $value := .Tasks}} {{ if .Tasks}} {{range $key, $value := .Tasks}}
<div class="note" id="{{$value.Id}}"> <div class="note" id="{{$value.Id}}">
<p class="noteHeading">{{ $value.Title}}</p> <span class="toggle glyphicon glyphicon-resize-full"></span> <p class="noteHeading">{{ $value.Title}}{{if $value.IsOverdue}}<span class="overdue">Overdue</span>{{end}}</p> <span class="toggle glyphicon glyphicon-resize-full"></span>
<span class="noteContent"> <span class="noteContent">
{{$value.Content}} {{$value.Content}}

View File

@ -14,6 +14,7 @@ type Task struct {
Category string Category string
Referer string Referer string
Comments []Comment Comments []Comment
IsOverdue bool
} }
//Comment is the struct used to populate comments per tasks //Comment is the struct used to populate comments per tasks