bugfixes for test-repo. Closes #126 and #127

This commit is contained in:
Cássio Zen 2016-10-20 14:27:58 -02:00
parent 195479f088
commit bd1216c760
3 changed files with 7 additions and 9 deletions

View File

@ -182,7 +182,7 @@ export function loadEntry(entry, collection, slug) {
const backend = currentBackend(state.config);
dispatch(entryLoading(collection, slug));
let getPromise;
if (entry && entry.get('path')) {
if (entry && entry.get('path') && entry.get('partial')) {
getPromise = backend.getEntry(entry.get('collection'), entry.get('slug'), entry.get('path'));
} else {
getPromise = backend.lookupEntry(collection, slug);

View File

@ -48,7 +48,6 @@ export default class GitHub {
});
return Promise.all(promises);
}).then(entries => ({
pagination: 0,
entries,
}));
}

View File

@ -28,20 +28,19 @@ export default class TestRepo {
const entries = [];
const folder = collection.get('folder');
if (folder) {
for (var path in window.repoFiles[folder]) {
entries.push(createEntry(collection.get('name'), getSlug(path), folder + '/' + path, { raw: window.repoFiles[folder][path].content }));
for (const path in window.repoFiles[folder]) {
entries.push(createEntry(collection.get('name'), getSlug(path), `${ folder }/${ path }`, { raw: window.repoFiles[folder][path].content }));
}
}
return Promise.resolve({
pagination: {},
entries
entries,
});
}
lookupEntry(collection, slug) {
return this.entries(collection).then((response) => (
response.entries.filter((entry) => entry.slug === slug)[0]
return this.entries(collection).then(response => (
response.entries.filter(entry => entry.slug === slug)[0]
));
}
@ -52,7 +51,7 @@ export default class TestRepo {
if (newEntry) {
window.repoFiles[folder][fileName] = { content: entry.raw };
} else {
window.repoFiles[folder][fileName]['content'] = entry.raw;
window.repoFiles[folder][fileName].content = entry.raw;
}
mediaFiles.forEach(media => media.uploaded = true);
return Promise.resolve();