From 82a406699307e80a3f888eecaaaa859576431b80 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 4 May 2015 14:36:17 -0400 Subject: [PATCH] HTMLBars support for `plugin-outlet` --- .../discourse/helpers/plugin-outlet.js.es6 | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/discourse/helpers/plugin-outlet.js.es6 b/app/assets/javascripts/discourse/helpers/plugin-outlet.js.es6 index de4e81a47ed..0e692c35031 100644 --- a/app/assets/javascripts/discourse/helpers/plugin-outlet.js.es6 +++ b/app/assets/javascripts/discourse/helpers/plugin-outlet.js.es6 @@ -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); } -} +});