mirror of
https://github.com/wassname/HackFlowy.git
synced 2026-07-04 17:10:05 +08:00
method to mark the model complete/ uncomplete
This commit is contained in:
@@ -10,9 +10,23 @@ Backbone
|
||||
|
||||
defaults: {
|
||||
parent_id: '',
|
||||
content: ''
|
||||
content: '',
|
||||
is_completed:'n'
|
||||
},
|
||||
|
||||
toggelCompletedStatus:function(isCompleted){
|
||||
var prev_isCompleted = isCompleted,
|
||||
self = this;
|
||||
this.save({'is_completed':isCompleted},
|
||||
{
|
||||
success:function(){},
|
||||
error:function(){
|
||||
//REVERT BACK ON ERROR
|
||||
self.set({'is_completed':prev_isCompleted});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return TaskModel;
|
||||
|
||||
Reference in New Issue
Block a user