spec compliance wip

This commit is contained in:
Mo Bitar
2016-12-10 21:32:29 -06:00
parent c6ab2f4122
commit 7bbd18e75c
11 changed files with 231 additions and 165 deletions

View File

@@ -2,13 +2,30 @@ var Note = function (json_obj) {
_.merge(this, json_obj);
};
Note.prototype = {
set content(content) {
try {
var data = JSON.parse(content);
this.title = data.title || data.name;
this.text = data.text || data.content;
}
catch(e) {
this.text = content;
}
}
}
Note.prototype.JSONContent = function() {
return JSON.stringify({title: this.title, text: this.text});
};
/* Returns true if note is shared individually or via group */
Note.prototype.isPublic = function() {
return this.hasEnabledPresentation() || this.shared_via_group;
};
Note.prototype.isEncrypted = function() {
return this.local_eek ? true : false;
return this.loc_eek || this.local_eek ? true : false;
}
Note.prototype.hasEnabledPresentation = function() {