mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-18 07:51:55 +03:00
058b82bba1
fixes #1645 - removes server.get('ghost root') as it is only an alias to config.paths().path, and adds unnecessary indirection - removes config.theme().path as its just an alias to config.paths().path, updated all relevant references - update config.theme.update to only require the api/settings object, and no longer need the config object - modify api/settings.edit to call config.theme.update so that the themeObject is ready for next rendering of template
39 lines
1.0 KiB
JavaScript
39 lines
1.0 KiB
JavaScript
// Holds all theme configuration information
|
|
// that as mostly used by templates and handlebar helpers.
|
|
|
|
var when = require('when'),
|
|
|
|
// Variables
|
|
theme,
|
|
themeConfig = {},
|
|
update;
|
|
|
|
|
|
function theme() {
|
|
return themeConfig;
|
|
}
|
|
|
|
// We must pass the api.settings object
|
|
// into this method due to circular dependencies.
|
|
// If we were to require the api module here
|
|
// there would be a race condition where the ./models/base
|
|
// tries to access the config() object before it is created.
|
|
function update(settings) {
|
|
return when.all([
|
|
settings.read('title'),
|
|
settings.read('description'),
|
|
settings.read('logo'),
|
|
settings.read('cover')
|
|
]).then(function (globals) {
|
|
|
|
themeConfig.title = globals[0].value;
|
|
themeConfig.description = globals[1].value;
|
|
themeConfig.logo = globals[2] ? globals[2].value : '';
|
|
themeConfig.cover = globals[3] ? globals[3].value : '';
|
|
return;
|
|
});
|
|
}
|
|
|
|
module.exports = theme;
|
|
module.exports.update = update;
|