Integrate SFJS model management
This commit is contained in:
@@ -64,7 +64,7 @@ angular.module('app')
|
||||
return;
|
||||
}
|
||||
|
||||
if(!ModelManager.isMappingSourceRetrieved(source)) {
|
||||
if(!SFModelManager.isMappingSourceRetrieved(source)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -554,7 +554,7 @@ angular.module('app')
|
||||
|
||||
// Currently extensions are not notified of association until a full server sync completes.
|
||||
// We need a better system for this, but for now, we'll manually notify observers
|
||||
modelManager.notifySyncObserversOfModels([this.note], ModelManager.MappingSourceLocalSaved);
|
||||
modelManager.notifySyncObserversOfModels([this.note], SFModelManager.MappingSourceLocalSaved);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -564,7 +564,7 @@ angular.module('app')
|
||||
|
||||
// Currently extensions are not notified of association until a full server sync completes.
|
||||
// We need a better system for this, but for now, we'll manually notify observers
|
||||
modelManager.notifySyncObserversOfModels([this.note], ModelManager.MappingSourceLocalSaved);
|
||||
modelManager.notifySyncObserversOfModels([this.note], SFModelManager.MappingSourceLocalSaved);
|
||||
}
|
||||
|
||||
else if(action === "save-items" || action === "save-success" || action == "save-error") {
|
||||
|
||||
@@ -87,7 +87,8 @@ angular.module('app')
|
||||
}
|
||||
|
||||
function loadAllTag() {
|
||||
var allTag = new Tag({all: true, title: "All"});
|
||||
var allTag = new Tag({content: {title: "All"}});
|
||||
allTag.all = true;
|
||||
allTag.needsLoad = true;
|
||||
$scope.allTag = allTag;
|
||||
$scope.tags = modelManager.tags;
|
||||
@@ -95,7 +96,8 @@ angular.module('app')
|
||||
}
|
||||
|
||||
function loadArchivedTag() {
|
||||
var archiveTag = new Tag({archiveTag: true, title: "Archived"});
|
||||
var archiveTag = new Tag({content: {title: "Archived"}});
|
||||
archiveTag.archiveTag = true;
|
||||
$scope.archiveTag = archiveTag;
|
||||
$scope.archiveTag.notes = modelManager.notes;
|
||||
}
|
||||
@@ -115,8 +117,6 @@ angular.module('app')
|
||||
|
||||
for(var tagToRemove of toRemove) {
|
||||
note.removeItemAsRelationship(tagToRemove);
|
||||
tagToRemove.removeItemAsRelationship(note);
|
||||
tagToRemove.setDirty(true);
|
||||
}
|
||||
|
||||
var tags = [];
|
||||
@@ -128,7 +128,7 @@ angular.module('app')
|
||||
}
|
||||
|
||||
for(var tag of tags) {
|
||||
modelManager.createRelationshipBetweenItems(note, tag);
|
||||
note.addItemAsRelationship(tag);
|
||||
}
|
||||
|
||||
note.setDirty(true);
|
||||
@@ -190,7 +190,8 @@ angular.module('app')
|
||||
modelManager.addItem(note);
|
||||
|
||||
if(!$scope.selectedTag.all && !$scope.selectedTag.archiveTag) {
|
||||
modelManager.createRelationshipBetweenItems($scope.selectedTag, note);
|
||||
note.addItemAsRelationship($scope.selectedTag);
|
||||
note.setDirty(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -217,8 +217,9 @@ angular.module('app')
|
||||
|
||||
this.createNewNote = function() {
|
||||
var title = "New Note" + (this.tag.notes ? (" " + (this.tag.notes.length + 1)) : "");
|
||||
this.newNote = modelManager.createItem({content_type: "Note", dummy: true, text: ""});
|
||||
this.newNote.title = title;
|
||||
let newNote = modelManager.createItem({content_type: "Note", content: {text: "", title: title}});
|
||||
newNote.dummy = true;
|
||||
this.newNote = newNote;
|
||||
this.selectNote(this.newNote);
|
||||
this.addNew()(this.newNote);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user