HTMLBars support for `plugin-outlet`
This commit is contained in:
parent
df3c19705f
commit
82a4066993
|
@ -99,11 +99,10 @@ function buildConnectorCache() {
|
|||
});
|
||||
}
|
||||
|
||||
export default function(connectionName, options) {
|
||||
if (!_connectorCache) { buildConnectorCache(); }
|
||||
Ember.HTMLBars._registerHelper('plugin-outlet', function(params, hash, options, env) {
|
||||
const connectionName = params[0];
|
||||
|
||||
console.warn('plugin outlets are disabled');
|
||||
return;
|
||||
if (!_connectorCache) { buildConnectorCache(); }
|
||||
|
||||
if (_connectorCache[connectionName]) {
|
||||
const childViews = _connectorCache[connectionName];
|
||||
|
@ -113,9 +112,9 @@ export default function(connectionName, options) {
|
|||
const viewClass = (childViews.length > 1) ? Ember.ContainerView : childViews[0];
|
||||
|
||||
delete options.fn; // we don't need the default template since we have a connector
|
||||
Ember.Handlebars.helpers.view.call(this, viewClass, options);
|
||||
env.helpers.view.helperFunction.call(this, [viewClass], hash, options, env);
|
||||
|
||||
const cvs = options.data.view._childViews;
|
||||
const cvs = env.data.view._childViews;
|
||||
if (childViews.length > 1 && cvs && cvs.length) {
|
||||
const inserted = cvs[cvs.length-1];
|
||||
if (inserted) {
|
||||
|
@ -127,13 +126,13 @@ export default function(connectionName, options) {
|
|||
} else if (options.fn) {
|
||||
// If a block is passed, render its content.
|
||||
return Ember.Handlebars.helpers.view.call(this,
|
||||
Ember.View.extend({
|
||||
[Ember.View.extend({
|
||||
isVirtual: true,
|
||||
tagName: '',
|
||||
template: function() {
|
||||
return options.hash.template;
|
||||
}.property()
|
||||
}),
|
||||
options);
|
||||
})],
|
||||
hash, options, env);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue