isfolded column, uuid instead of int for id

This commit is contained in:
2016-02-02 13:25:24 +08:00
parent 8678dd220b
commit 0c2e8179e2
12 changed files with 215 additions and 215 deletions
+21 -4
View File
@@ -18,6 +18,22 @@ localforageBackbone
model: Task,
offlineSync: Backbone.localforage.sync("tasks"),
/** Override backbone parse **/
// parse: function(models){
// if (this._isModel(models))
// return models;
// var parsedModels =[];
// for (var i = 0; i < models.length; i++) {
// if (this._isModel(models[i]))
// parsedModels.push(models[i]);
// else
// parsedModels.push(new this.model(models[i]));
// }
// return parsedModels;
//
// },
initialize: function(){
// update order on add, remove.
// Ref: http://stackoverflow.com/a/11665085/221742
@@ -53,8 +69,9 @@ localforageBackbone
/** Updated priority of each member of list **/
updateModelPriority: function() {
this.each(function(model, index) {
if (model)
model.set('priority', index);
if (model && model.get('priority')!==index)
model.save({'priority': index});
}, this);
},
@@ -71,8 +88,8 @@ localforageBackbone
},
/** sort by priority then created date **/
comporator: function(child){
return [child.get('priority'), child.get('createdAt')];
comparator: function(child){
return [child.get('priority')];
},
url: '/tasks'