mirror of
https://github.com/wassname/HackFlowy.git
synced 2026-06-27 16:00:04 +08:00
17 lines
494 B
JavaScript
17 lines
494 B
JavaScript
var NodeModel = Backbone.Model.extend({
|
|
|
|
getAncestry: function(){
|
|
var that = this;
|
|
|
|
var ancestry = [];
|
|
var parents = that.get("parents");
|
|
while( !(parents[0] == "a42a" || parents[0]=="42" || parents.length==0) ) {
|
|
ancestry.push(parents);
|
|
parents = nodesCollection.findWhere({_id: parents[0]}).get("parents");
|
|
// parents = that.findModel(parents[0]).get("parents");
|
|
//making the assumption/simplification that it's a tree. Not a graph.
|
|
}
|
|
return ancestry;
|
|
}
|
|
|
|
}); |