Fix sorting, add delete, fold options

This commit is contained in:
2016-02-01 17:03:21 +08:00
parent 4cde8f6fe2
commit 5cb9ead162
5 changed files with 9 additions and 11 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ localforageBackbone
initialize: function(){
// update order on add, remove.
// Ref: http://stackoverflow.com/a/11665085/221742
this.on('add remove', this.updateModelPriority);
this.on('add remove sort', this.updateModelPriority);
},
/**
+1 -1
View File
@@ -109,8 +109,8 @@ List
updateBreadCrumbs: function(){
var rootId = this.getRootId();
this.$('#task-breadcrumbs').empty();
if (rootId){
this.$('#task-breadcrumbs').empty();
var current = this.collection.get(rootId);
var breadCrumbs = '';//_.template('<a href="#<%= id %>"><%= content %></a>')(current.attributes);
var depth=0;
+3 -6
View File
@@ -20,7 +20,7 @@ define(
// The recursive tree view. Ref:http://jsfiddle.net/wassname/zf61mLvh/2/
var TaskView = Backbone.Marionette.CompositeView.extend({
template: _.template(taskTemplate), //'#task-view-template',
template: _.template(taskTemplate),
tagName: 'ul',
className: "task-view",
viewComparator: List.prototype.comporator,
@@ -52,6 +52,8 @@ define(
'click .uncomplete:first': 'unmarkComlete',
'click .note:first': 'addNote',
'click .fold-button:first': 'foldChildren',
'click .fold:first': 'foldChildren',
'click .destroy:first': 'destroy',
// custom events
'focus': 'this.model.focusOnView',
@@ -65,11 +67,6 @@ define(
initialize: function (options) {
var task = this;
// options
if (!('reorderOnSort' in options)) {
options.reorderOnSort = true;
}
// backlink
this.model.view = this;