modelmanager refactor complete

This commit is contained in:
Mo Bitar
2017-01-05 10:59:44 -06:00
parent 4a35e78765
commit 117d6fca4e
7 changed files with 89 additions and 87 deletions

View File

@@ -68,7 +68,7 @@ class Item {
// must override
}
removeFromRelationships() {
removeAllRelationships() {
// must override
}

View File

@@ -18,6 +18,7 @@ class Note extends Item {
var references = _.map(this.tags, function(tag){
return {uuid: tag.uuid, content_type: tag.content_type};
})
return references;
}
@@ -47,11 +48,12 @@ class Note extends Item {
super.removeItemAsRelationship(item);
}
removeFromRelationships() {
removeAllRelationships() {
this.tags.forEach(function(tag){
_.pull(tag.notes, this);
tag.dirty = true;
})
}.bind(this))
this.tags = [];
}
static filterDummyNotes(notes) {

View File

@@ -17,6 +17,7 @@ class Tag extends Item {
var references = _.map(this.notes, function(note){
return {uuid: note.uuid, content_type: note.content_type};
})
return references;
}
@@ -45,11 +46,13 @@ class Tag extends Item {
super.removeItemAsRelationship(item);
}
removeFromRelationships() {
removeAllRelationships() {
this.notes.forEach(function(note){
_.pull(note.tags, this);
note.dirty = true;
})
}.bind(this))
this.notes = [];
}
get content_type() {