editor note references
This commit is contained in:
@@ -2,6 +2,9 @@ class Editor extends Item {
|
||||
|
||||
constructor(json_obj) {
|
||||
super(json_obj);
|
||||
if(!this.notes) {
|
||||
this.notes = [];
|
||||
}
|
||||
}
|
||||
|
||||
mapContentToLocalProperties(contentObject) {
|
||||
@@ -22,6 +25,44 @@ class Editor extends Item {
|
||||
return params;
|
||||
}
|
||||
|
||||
referenceParams() {
|
||||
var references = _.map(this.notes, function(note){
|
||||
return {uuid: note.uuid, content_type: note.content_type};
|
||||
})
|
||||
|
||||
return references;
|
||||
}
|
||||
|
||||
addItemAsRelationship(item) {
|
||||
if(item.content_type == "Note") {
|
||||
if(!_.find(this.notes, item)) {
|
||||
this.notes.push(item);
|
||||
}
|
||||
}
|
||||
super.addItemAsRelationship(item);
|
||||
}
|
||||
|
||||
removeItemAsRelationship(item) {
|
||||
if(item.content_type == "Note") {
|
||||
_.pull(this.notes, item);
|
||||
}
|
||||
super.removeItemAsRelationship(item);
|
||||
}
|
||||
|
||||
removeAllRelationships() {
|
||||
super.removeAllRelationships();
|
||||
this.notes = [];
|
||||
}
|
||||
|
||||
locallyClearAllReferences() {
|
||||
super.locallyClearAllReferences();
|
||||
this.notes = [];
|
||||
}
|
||||
|
||||
allReferencedObjects() {
|
||||
return this.notes;
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
return {uuid: this.uuid}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ class Note extends Item {
|
||||
_.pull(tag.notes, this);
|
||||
}.bind(this))
|
||||
this.tags = [];
|
||||
}
|
||||
}
|
||||
|
||||
isBeingRemovedLocally() {
|
||||
this.tags.forEach(function(tag){
|
||||
|
||||
@@ -16,7 +16,7 @@ class ItemParams {
|
||||
}
|
||||
|
||||
paramsForLocalStorage() {
|
||||
this.additionalFields = ["updated_at", "dirty", "editorUrl"];
|
||||
this.additionalFields = ["updated_at", "dirty"];
|
||||
this.forExportFile = true;
|
||||
return this.__params();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user