Use HTMLBars API for inserting partials and views

This commit is contained in:
Robin Ward 2015-05-05 17:05:09 -04:00
parent 39a1444838
commit d34334ecbe
3 changed files with 7 additions and 16 deletions

View File

@ -316,7 +316,7 @@
</div>
{{/if}}
<div class='display-row' {{bind-attr class=":display-row blocked:highlight-danger"}}>
<div {{bind-attr class=":display-row blocked:highlight-danger"}}>
<div class='field'>{{i18n 'admin.user.blocked'}}</div>
<div class='value'>{{blocked}}</div>
<div class='controls'>

View File

@ -1,9 +1,11 @@
Ember.Handlebars.registerHelper('custom-html', function(name, contextString, options) {
var html = Discourse.HTML.getCustomHTML(name);
Ember.HTMLBars._registerHelper('custom-html', function(params, hash, options, env) {
const name = params[0];
const html = Discourse.HTML.getCustomHTML(name);
if (html) { return html; }
var container = (options || contextString).data.view.container;
const contextString = params[1];
const container = (env || contextString).data.view.container;
if (container.lookup('template:' + name)) {
return Ember.Handlebars.helpers.partial.apply(this, arguments);
return env.helpers.partial.helperFunction.apply(this, arguments);
}
});

View File

@ -123,16 +123,5 @@ Ember.HTMLBars._registerHelper('plugin-outlet', function(params, hash, options,
});
}
}
} else if (options.fn) {
// If a block is passed, render its content.
return Ember.Handlebars.helpers.view.call(this,
[Ember.View.extend({
isVirtual: true,
tagName: '',
template: function() {
return options.hash.template;
}.property()
})],
hash, options, env);
}
});