api format, css, auth errors

This commit is contained in:
Mo Bitar
2016-12-27 13:27:57 -06:00
parent 36d90804d0
commit 139c8c62e6
14 changed files with 432 additions and 316 deletions

View File

@@ -26,6 +26,14 @@ class Item {
_.merge(this, json_obj);
if(this.created_at) {
this.created_at = new Date(this.created_at);
this.updated_at = new Date(this.updated_at);
} else {
this.created_at = new Date();
this.updated_at = new Date();
}
if(!this.uuid) {
this.uuid = Neeto.crypto.generateUUID();
}
@@ -43,6 +51,12 @@ class Item {
}
}
static sortItemsByDate(items) {
items.sort(function(a,b){
return new Date(b.created_at) - new Date(a.created_at);
});
}
addReference(reference) {
this.content.references.push(reference);
this.content.references = _.uniq(this.content.references);