mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-23 10:53:34 +03:00
3cea203459
no issue 🔥 Remove adminHbs concept from tests 🔥 Get rid of unnecessary helper test utils 🔥 Remove helper missing code - this hasn't been registered / used for ages 😱 - gscan no longer allows us to activate themes that have missing helpers, so this wouldn't be used anyway TODO: consider whether we should make a way to override this? 🎨 Reduce coupling inside of /helpers 🎨 Use settingsCache in ghost_foot ✨ Labs util for enabling helpers 🎨 Move loadCoreHelpers to blog - This needs a proper home, but at the very least it doesn't belong in server/app.js! 🎨 Use settingsCache in ghost_head
31 lines
1015 B
JavaScript
31 lines
1015 B
JavaScript
var _ = require('lodash'),
|
|
utils;
|
|
|
|
utils = {
|
|
assetTemplate: _.template('<%= source %>?v=<%= version %>'),
|
|
linkTemplate: _.template('<a href="<%= url %>"><%= text %></a>'),
|
|
scriptTemplate: _.template('<script src="<%= source %>?v=<%= version %>"></script>'),
|
|
inputTemplate: _.template('<input class="<%= className %>" type="<%= type %>" name="<%= name %>" <%= extras %> />'),
|
|
// @TODO this can probably be made more generic and used in more places
|
|
findKey: function findKey(key, object, data) {
|
|
if (object && _.has(object, key) && !_.isEmpty(object[key])) {
|
|
return object[key];
|
|
}
|
|
|
|
if (data && _.has(data, key) && !_.isEmpty(data[key])) {
|
|
return data[key];
|
|
}
|
|
|
|
return null;
|
|
},
|
|
parseVisibility: function parseVisibility(options) {
|
|
if (!options.hash.visibility) {
|
|
return ['public'];
|
|
}
|
|
|
|
return _.map(options.hash.visibility.split(','), _.trim);
|
|
}
|
|
};
|
|
|
|
module.exports = utils;
|