FEATURE: Allow customHTML helper to resolve to a template if it

exists.
This commit is contained in:
Robin Ward 2014-03-06 13:32:32 -05:00
parent 11d91328ab
commit e2ea148e38
2 changed files with 12 additions and 3 deletions

View file

@ -2,6 +2,7 @@
<div {{bind-attr class=":dashboard-stats :version-check versionCheck.critical_updates:critical:normal"}}>
<table class="table table-condensed table-hover">
<thead>
{{customHTML 'upgrade-header'}}
<tr>
<th>&nbsp;</th>
<th>{{i18n admin.dashboard.installed_version}}</th>

View file

@ -337,13 +337,21 @@ Ember.Handlebars.registerBoundHelper('date', function(dt) {
});
/**
Look for custom html content using `Discourse.HTML`
Look for custom html content using `Discourse.HTML`. If none exists, look for a template
to render with that name.
@method customHTML
@for Handlebars
**/
Handlebars.registerHelper('customHTML', function(property) {
return Discourse.HTML.getCustomHTML(property);
Handlebars.registerHelper('customHTML', function(name, contextString, options) {
var html = Discourse.HTML.getCustomHTML(name);
if (html) { return html; }
var container = (options || contextString).data.keywords.controller.container;
if (container.lookup('template:' + name)) {
return Ember.Handlebars.helpers.render.apply(this, arguments);
}
});
Ember.Handlebars.registerBoundHelper('humanSize', function(size) {