mirror of
https://github.com/wassname/HackFlowy.git
synced 2026-06-27 16:00:04 +08:00
36 lines
535 B
JavaScript
36 lines
535 B
JavaScript
define(
|
|
['backbone'
|
|
],
|
|
|
|
function(
|
|
Backbone
|
|
) {
|
|
|
|
var TaskModel = Backbone.Model.extend({
|
|
|
|
defaults: {
|
|
parentId: 0,
|
|
content: '',
|
|
isCompleted: 0,
|
|
priority: 0
|
|
},
|
|
|
|
toggelCompletedStatus:function(isCompleted){
|
|
var prev_isCompleted = isCompleted,
|
|
self = this;
|
|
this.save({'isCompleted':isCompleted},
|
|
{
|
|
success:function(){},
|
|
error:function(){
|
|
//REVERT BACK ON ERROR
|
|
self.set({'isCompleted':prev_isCompleted});
|
|
}
|
|
})
|
|
}
|
|
|
|
});
|
|
|
|
return TaskModel;
|
|
|
|
});
|