Add json format support

This commit is contained in:
Mathias Biilmann Christensen
2016-10-27 15:33:15 +02:00
parent 7713c4c6f8
commit 80a2cefbf0
4 changed files with 28 additions and 16 deletions

View File

@ -87,13 +87,8 @@ class Backend {
// We have the file path. Fetch and parse the file.
getEntry(collection, slug, path) {
return this.implementation.getEntry(collection, slug, path).then(this.entryWithFormat(collection));
}
lookupEntry(collection, slug) {
const collectionModel = new Collection(collection);
return this.implementation.getEntry(collection, slug, collectionModel.entryPath(slug))
.then(loadedEntry => this.entryWithFormat(collection)(createEntry(
return this.implementation.getEntry(collection, slug, path)
.then(loadedEntry => this.entryWithFormat(collection, slug)(createEntry(
collection.get('name'),
slug,
loadedEntry.file.path,
@ -102,6 +97,10 @@ class Backend {
);
}
lookupEntry(collection, slug) {
return this.getEntry(collection, slug, new Collection(collection).entryPath(slug));
}
newEntry(collection) {
return createEntry(collection.get('name'));
}