return this;
}
// Position was given as an index into the children array, not relative to inserted elements in the DOM.
- // So, convert to index relative to things inserted so far
- var relativePosition = _.chain(this.childViewPositions).where(function(x) { return x<= position; }).size().value();
- this.childViewPositions.push(position);
- if (relativePosition === 0) {
+ // Nonetheless assume they're the same (either we're inserting in the middle of a populated array, or we're loading in order)
+ if (position === 0) {
this.$el.find("> .bullets").prepend(el);
} else {
- this.$el.find("> .bullets > *").eq(relativePosition-1).after(el);
+ this.$el.find("> .bullets > *").eq(position-1).after(el);
}
return this;
},
new TodoModel({
parent: null,
id: 0,
- text: "Root (will be invisible in final)",
+ text: "Root (will be invisible in final, DO NOT EDIT)",
bullets: [1, 5],
}),
new TodoModel({
return this;
}
// Position was given as an index into the children array, not relative to inserted elements in the DOM.
- // So, convert to index relative to things inserted so far
- var relativePosition = _.chain(this.childViewPositions).where(function(x) { return x<= position; }).size().value();
- this.childViewPositions.push(position);
- if (relativePosition === 0) {
+ // Nonetheless assume they're the same (either we're inserting in the middle of a populated array, or we're loading in order)
+ if (position === 0) {
this.$el.find("> .bullets").prepend(el);
} else {
- this.$el.find("> .bullets > *").eq(relativePosition-1).after(el);
+ this.$el.find("> .bullets > *").eq(position-1).after(el);
}
return this;
},
new TodoModel({
parent: null,
id: 0,
- text: "Root (will be invisible in final)",
+ text: "Root (will be invisible in final, DO NOT EDIT)",
bullets: [1, 5],
}),
new TodoModel({
new TodoModel({
parent: null,
id: 0,
- text: "Root (will be invisible in final)",
+ text: "Root (will be invisible in final, DO NOT EDIT)",
bullets: [1, 5],
}),
new TodoModel({
return this;
}
// Position was given as an index into the children array, not relative to inserted elements in the DOM.
- // So, convert to index relative to things inserted so far
- var relativePosition = _.chain(this.childViewPositions).where(function(x) { return x<= position; }).size().value();
- this.childViewPositions.push(position);
- if (relativePosition === 0) {
+ // Nonetheless assume they're the same (either we're inserting in the middle of a populated array, or we're loading in order)
+ if (position === 0) {
this.$el.find("> .bullets").prepend(el);
} else {
- this.$el.find("> .bullets > *").eq(relativePosition-1).after(el);
+ this.$el.find("> .bullets > *").eq(position-1).after(el);
}
return this;
},