Replaced config.blogData with settings

Solves #112
* Removed config.blogData
* Changed Ghost.init() to accommodate new settings bits
* (data was already in the fixtures)
This commit is contained in:
Gabor Javorszky 2013-06-15 00:39:27 +01:00
parent 5d901e5238
commit 81d317a122
2 changed files with 18 additions and 13 deletions

View File

@ -12,15 +12,6 @@
*/
var config = {};
/**
* Blog settings
*/
config.blogData = {
url: 'http://local.tryghost.org', //'http://john.onolan.org',
title: "Ghost Development",
description: "Interactive designer, public speaker, startup advisor and writer. Living in Austria, attempting world domination via keyboard."
};
// ## Admin settings
/**
@ -109,4 +100,4 @@
* @property {Object} exports
*/
module.exports = config;
}());
}());

View File

@ -121,9 +121,23 @@
};
Ghost.prototype.init = function () {
this.globalConfig = config.blogData;
var settings = {},
self = this,
configDeferred = when.defer(),
configPromise = configDeferred.promise;
return when.all([instance.dataProvider.init(), instance.getPaths()]);
models.Settings.findAll().then(function (result) {
_.map(result.models, function (member) {
if (!settings.hasOwnProperty(member.attributes.key)) {
settings[member.attributes.key] = member.attributes.value;
}
});
configDeferred.resolve(settings);
});
return when.all([instance.dataProvider.init(), instance.getPaths(), configPromise]).then(function (results) {
self.globalConfig = results[2];
return;
});
};
/**
@ -230,4 +244,4 @@
// Ghost.defaults = defaults;
module.exports = Ghost;
}());
}());