This repository has been archived by the owner on Jun 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
605 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,5 @@ npm-debug.log | |
|
||
.idea | ||
.idea/* | ||
|
||
*.sublime* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
define(['backbone', 'models/task', 'views/tasks/single'], function (Backbone, Task, TaskView) { | ||
|
||
"use strict"; | ||
|
||
return Backbone.Collection.extend({ | ||
|
||
url:"/api/tasks", | ||
|
||
model:Task, | ||
|
||
initialize:function (options) { | ||
|
||
options = options || {}; | ||
this.limit = options.limit || -1; | ||
|
||
// used when fetching a limited number of results | ||
if (this.limit > 0) { | ||
this.url = this.url + "/limit/" + this.limit; | ||
} | ||
|
||
} | ||
|
||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
define(['backbone', 'backbone-validate', 'moment'], function(Backbone, validation, moment) { | ||
|
||
"use strict"; | ||
|
||
return Backbone.Model.extend({ | ||
|
||
idAttribute: "_id", | ||
|
||
urlRoot: "/api/tasks", | ||
|
||
/*validation: { | ||
name: { | ||
required: true, | ||
min: 3, | ||
max: 100, | ||
msg: "Name is required" | ||
}, | ||
description: { | ||
max: 1000, | ||
msg: "Invalid description" | ||
}, | ||
deadline: { | ||
} | ||
},*/ | ||
|
||
defaults: { | ||
_id: null, | ||
name: "Untitled Task", | ||
description: "", | ||
points: 0, | ||
deadline: new Date(), | ||
created: new Date(), | ||
updated: new Date() | ||
|
||
}, | ||
|
||
initialize: function() { | ||
}, | ||
|
||
parse: function(response) { | ||
|
||
var deadline, deadlineStatus = "", today = moment(); | ||
|
||
if(response) { | ||
|
||
if(response.deadline && moment(response.deadline).isValid()) { | ||
|
||
deadline = moment(response.deadline); | ||
|
||
if(deadline.unix() < today.unix()) { | ||
deadlineStatus = "deadline-past"; | ||
} else { | ||
deadlineStatus = "deadline-future"; | ||
} | ||
|
||
// "6 days from now formatting" | ||
response.humanFriendlyDeadline = deadline.fromNow(); | ||
response.deadline = deadline.format("MM/DD/YYYY"); | ||
|
||
} else { | ||
response.deadline = "date missing or invalid"; | ||
} | ||
|
||
if(!response.status || !response.status.length) { | ||
response.status = "Pending"; | ||
} else { | ||
// decipher status | ||
response.status = response.status[0].name; | ||
} | ||
|
||
response.deadlineStatus = deadlineStatus; | ||
|
||
|
||
} | ||
|
||
return response; | ||
|
||
} | ||
|
||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<div class="alert is-not-displayed"></div> | ||
<fieldset> | ||
|
||
<legend><%= formEditMode %> Task</legend> | ||
|
||
<div class="control-group"> | ||
|
||
<label class="control-label" for="status">Status</label> | ||
<div class="controls"> | ||
<select id="status" name="status"> | ||
<option value="Pending">Pending</option> | ||
<option value="Completed">Completed</option> | ||
<option value="Archived">Archived</option> | ||
</select> | ||
</div> | ||
|
||
</div> | ||
|
||
<div class="control-group"> | ||
<label class="control-label" for="name">Name</label> | ||
|
||
<div class="controls"> | ||
<input type="text" id="name" class="input-xxlarge" name="name" placeholder="Quest Name" value="<%= name %>"/> | ||
</div> | ||
</div> | ||
|
||
<div class="control-group"> | ||
<label class="control-label" for="description">Description</label> | ||
|
||
<div class="controls"> | ||
<textarea id="description" class="input-xxlarge" name="description" placeholder="Quest Description"><%= description %></textarea> | ||
</div> | ||
</div> | ||
|
||
<div class="control-group"> | ||
<label class="control-label" for="deadline">Deadline</label> | ||
|
||
<div class="controls"> | ||
<input type="datetime" id="deadline" name="deadline" placeholder="Quest Deadline" class="human-friendly-date" data-machine-date="<%= deadline %>" value="<%= deadline %>"/> | ||
</div> | ||
</div> | ||
|
||
<div class="control-group"> | ||
|
||
<label class="control-label" for="status">Points</label> | ||
<div class="controls"> | ||
<select id="points" name="points"> | ||
<% for(var ctr = 0; ctr < 1; ctr += 0.1) { %> | ||
<option value="<%= ctr %>"><%= ctr %></option> | ||
<% } %> | ||
</select> | ||
</div> | ||
|
||
</div> | ||
|
||
<div class="controls"> | ||
<input type="button" name="save" class="btn btn-primary btn-save" value="save"/> <a href="/tasks/<%= _id %>" class="btn btn-cancel">Cancel</a> | ||
</div> | ||
|
||
</fieldset> |
Oops, something went wrong.