Added url to sub-lists

This commit is contained in:
2016-02-01 16:37:05 +08:00
parent 855fbb1a3f
commit 4cde8f6fe2
10 changed files with 329 additions and 173 deletions
+14 -4
View File
@@ -24,20 +24,30 @@ localforageBackbone
this.on('add remove', this.updateModelPriority);
},
/**
* Move a model in the list up. Only a sort event is emitted
* @param {Backbone.Model} model - Model to be moved
*/
moveUp: function(model) { // I see move up as the -1
var index = this.indexOf(model);
if (index > 0) {
this.remove(model, {silent: true}); // silence this to stop excess event triggers
this.add(model, {at: index-1});
this.remove(model, {silent: true});
this.add(model, {at: index-1, silent: true});
}
this.trigger('sort', this, {});
},
/**
* Move a model in the list up. Only a sort event is emitted
* @param {Backbone.Model} model - Model to be moved
*/
moveDown: function(model) { // I see move up as the -1
var index = this.indexOf(model);
if (index < this.models.length) {
this.remove(model, {silent: true}); // silence this to stop excess event triggers
this.add(model, {at: index+1});
this.remove(model, {silent: true});
this.add(model, {at: index+1, silent: true});
}
this.trigger('sort', this, {});
},
/** Updated priority of each member of list **/