Merge pull request #122 from jorilallo/new-collection

Create a collection
This commit is contained in:
Jori Lallo
2017-07-10 00:42:10 -07:00
committed by GitHub
23 changed files with 405 additions and 57 deletions

View File

@@ -30,6 +30,7 @@ class Document {
starred: boolean = false;
text: string = '';
title: string = 'Untitled document';
parentDocument: ?Document;
updatedAt: string;
updatedBy: User;
url: string;
@@ -151,13 +152,14 @@ class Document {
return this;
};
updateData(data: Object | Document) {
updateData(data: Object = {}, dirty: boolean = false) {
if (data.text) data.title = parseHeader(data.text);
if (dirty) data.hasPendingChanges = true;
extendObservable(this, data);
}
constructor(document?: Object = {}) {
this.updateData(document);
constructor(data?: Object = {}) {
this.updateData(data);
this.errors = stores.errors;
}
}