mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
FEATURE: Allow customHTML
helper to resolve to a template if it
exists.
This commit is contained in:
parent
11d91328ab
commit
e2ea148e38
2 changed files with 12 additions and 3 deletions
|
@ -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> </th>
|
||||
<th>{{i18n admin.dashboard.installed_version}}</th>
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue