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"}}> <div {{bind-attr class=":dashboard-stats :version-check versionCheck.critical_updates:critical:normal"}}>
<table class="table table-condensed table-hover"> <table class="table table-condensed table-hover">
<thead> <thead>
{{customHTML 'upgrade-header'}}
<tr> <tr>
<th>&nbsp;</th> <th>&nbsp;</th>
<th>{{i18n admin.dashboard.installed_version}}</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 @method customHTML
@for Handlebars @for Handlebars
**/ **/
Handlebars.registerHelper('customHTML', function(property) { Handlebars.registerHelper('customHTML', function(name, contextString, options) {
return Discourse.HTML.getCustomHTML(property); 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) { Ember.Handlebars.registerBoundHelper('humanSize', function(size) {