mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 19:52:01 +03:00
243b387063
refs #8126, #8221, #8223 ✨ New 'Proxy' for all helper requires - this is not currently enforced, but could be, much like apps - the proxy object is HUGE - changed date to use SafeString, this should have been there anyway - use the proxy for all helpers, including those in apps 😁 ✨ 🎨 Single instance of hbs for theme + for errors - we now have theme/engine instead of requiring express-hbs everywhere - only error-handler still also requires express-hbs, this is so that we can render errors without extra crud - TODO: remove the asset helper after #8126 IF it is not needed, or else remove the TODO 🎨 Cleanup visibility utils 🎨 Clean up the proxy a little bit 🚨 Unskip test as it now works! 🎨 Minor amends as per comments
72 lines
3.2 KiB
JavaScript
72 lines
3.2 KiB
JavaScript
var coreHelpers = {},
|
|
register = require('./register'),
|
|
registerThemeHelper = register.registerThemeHelper,
|
|
registerAsyncThemeHelper = register.registerAsyncThemeHelper,
|
|
registerAllCoreHelpers;
|
|
|
|
coreHelpers.asset = require('./asset');
|
|
coreHelpers.author = require('./author');
|
|
coreHelpers.body_class = require('./body_class');
|
|
coreHelpers.content = require('./content');
|
|
coreHelpers.date = require('./date');
|
|
coreHelpers.encode = require('./encode');
|
|
coreHelpers.excerpt = require('./excerpt');
|
|
coreHelpers.facebook_url = require('./facebook_url');
|
|
coreHelpers.foreach = require('./foreach');
|
|
coreHelpers.get = require('./get');
|
|
coreHelpers.ghost_foot = require('./ghost_foot');
|
|
coreHelpers.ghost_head = require('./ghost_head');
|
|
coreHelpers.image = require('./image');
|
|
coreHelpers.is = require('./is');
|
|
coreHelpers.has = require('./has');
|
|
coreHelpers.meta_description = require('./meta_description');
|
|
coreHelpers.meta_title = require('./meta_title');
|
|
coreHelpers.navigation = require('./navigation');
|
|
coreHelpers.page_url = require('./page_url');
|
|
coreHelpers.pagination = require('./pagination');
|
|
coreHelpers.plural = require('./plural');
|
|
coreHelpers.post_class = require('./post_class');
|
|
coreHelpers.prev_post = require('./prev_next');
|
|
coreHelpers.next_post = require('./prev_next');
|
|
coreHelpers.tags = require('./tags');
|
|
coreHelpers.title = require('./title');
|
|
coreHelpers.twitter_url = require('./twitter_url');
|
|
coreHelpers.url = require('./url');
|
|
|
|
registerAllCoreHelpers = function registerAllCoreHelpers() {
|
|
// Register theme helpers
|
|
registerThemeHelper('asset', coreHelpers.asset);
|
|
registerThemeHelper('author', coreHelpers.author);
|
|
registerThemeHelper('body_class', coreHelpers.body_class);
|
|
registerThemeHelper('content', coreHelpers.content);
|
|
registerThemeHelper('date', coreHelpers.date);
|
|
registerThemeHelper('encode', coreHelpers.encode);
|
|
registerThemeHelper('excerpt', coreHelpers.excerpt);
|
|
registerThemeHelper('foreach', coreHelpers.foreach);
|
|
registerThemeHelper('has', coreHelpers.has);
|
|
registerThemeHelper('is', coreHelpers.is);
|
|
registerThemeHelper('image', coreHelpers.image);
|
|
registerThemeHelper('meta_description', coreHelpers.meta_description);
|
|
registerThemeHelper('meta_title', coreHelpers.meta_title);
|
|
registerThemeHelper('navigation', coreHelpers.navigation);
|
|
registerThemeHelper('page_url', coreHelpers.page_url);
|
|
registerThemeHelper('pagination', coreHelpers.pagination);
|
|
registerThemeHelper('plural', coreHelpers.plural);
|
|
registerThemeHelper('post_class', coreHelpers.post_class);
|
|
registerThemeHelper('tags', coreHelpers.tags);
|
|
registerThemeHelper('title', coreHelpers.title);
|
|
registerThemeHelper('twitter_url', coreHelpers.twitter_url);
|
|
registerThemeHelper('facebook_url', coreHelpers.facebook_url);
|
|
registerThemeHelper('url', coreHelpers.url);
|
|
|
|
// Async theme helpers
|
|
registerAsyncThemeHelper('ghost_foot', coreHelpers.ghost_foot);
|
|
registerAsyncThemeHelper('ghost_head', coreHelpers.ghost_head);
|
|
registerAsyncThemeHelper('next_post', coreHelpers.next_post);
|
|
registerAsyncThemeHelper('prev_post', coreHelpers.prev_post);
|
|
registerAsyncThemeHelper('get', coreHelpers.get);
|
|
};
|
|
|
|
module.exports = coreHelpers;
|
|
module.exports.loadCoreHelpers = registerAllCoreHelpers;
|