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()
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)

View File

@ -146,6 +146,15 @@ 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;

View File

@ -50,7 +50,9 @@
<div class="timeline">
{{ if .Tasks}} {{range $key, $value := .Tasks}}
<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">
{{$value.Content}}

View File

@ -3,7 +3,7 @@
<div class="timeline">
{{ if .Tasks}} {{range $key, $value := .Tasks}}
<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">
{{$value.Content}}

View File

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