Small refactor preparing for branch creating/editing. Also closes #58

This commit is contained in:
Cássio Zen
2016-08-29 17:09:04 -03:00
parent 2b70893e89
commit 6eec0feb72
12 changed files with 70 additions and 19 deletions

View File

@ -62,7 +62,6 @@ export function loadConfig(config) {
function parseConfig(data) {
const config = yaml.safeLoad(data);
if (typeof CMS_ENV === 'string' && config[CMS_ENV]) {
for (var key in config[CMS_ENV]) {
if (config[CMS_ENV].hasOwnProperty(key)) {
@ -70,5 +69,14 @@ function parseConfig(data) {
}
}
}
if ('media_folder' in config && typeof config.media_folder === 'string') {
// Parse source & public paths for media folder.
config.media_folder = {
path: config.media_folder,
public_path: config.media_folder
};
}
return config;
}

View File

@ -175,9 +175,8 @@ export function persistEntry(collection, entry) {
const state = getState();
const backend = currentBackend(state.config);
const MediaProxies = entry.get('mediaFiles').map(path => getMedia(state, path));
dispatch(entryPersisting(collection, entry));
backend.persistEntry(collection, entry, MediaProxies.toJS()).then(
backend.persistEntry(state.config, collection, entry, MediaProxies.toJS()).then(
() => {
dispatch(entryPersisted(collection, entry));
},