mirror of
https://github.com/wassname/HackFlowy.git
synced 2026-08-08 11:13:25 +08:00
fix newtask loop
This commit is contained in:
@@ -18,22 +18,6 @@ localforageBackbone
|
|||||||
model: Task,
|
model: Task,
|
||||||
offlineSync: Backbone.localforage.sync("tasks"),
|
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(){
|
initialize: function(){
|
||||||
// update order on add, remove.
|
// update order on add, remove.
|
||||||
// Ref: http://stackoverflow.com/a/11665085/221742
|
// Ref: http://stackoverflow.com/a/11665085/221742
|
||||||
@@ -69,9 +53,11 @@ localforageBackbone
|
|||||||
/** Updated priority of each member of list **/
|
/** Updated priority of each member of list **/
|
||||||
updateModelPriority: function() {
|
updateModelPriority: function() {
|
||||||
this.each(function(model, index) {
|
this.each(function(model, index) {
|
||||||
if (model && model.get('priority')!==index)
|
if (model && model.get('priority')!==index){
|
||||||
model.save({'priority': index});
|
model.set({'priority': index});
|
||||||
|
if (model.id)
|
||||||
|
model.save({'priority': index});
|
||||||
|
}
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ define(
|
|||||||
/** Finish editing an item **/
|
/** Finish editing an item **/
|
||||||
close: function () {
|
close: function () {
|
||||||
var value = this.$('.edit:first').val().trim();
|
var value = this.$('.edit:first').val().trim();
|
||||||
if (this.model.get('content')!=value)
|
if (this.model.get('content')!=value && value!=='')
|
||||||
this.model.save({content: value});
|
this.model.save({content: value});
|
||||||
this.$el.removeClass('editing');
|
this.$el.removeClass('editing');
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user