Use HTMLBars API for inserting partials and views
This commit is contained in:
parent
39a1444838
commit
d34334ecbe
|
@ -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'>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue