/**
A plugin outlet is an extension point for templates where other templates can
be inserted by plugins.
## Usage
If you handlebars template has:
```handlebars
{{plugin-outlet "evil-trout"}}
```
Then any handlebars files you create in the `connectors/evil-trout` directory
will automatically be appended. For example:
plugins/hello/assets/javascripts/discourse/templates/connectors/evil-trout/hello.hbs
With the contents:
```handlebars
Hello World
```
Will insert Hello World at that point in the template.
Optionally you can also define a view class for the outlet as:
plugins/hello/assets/javascripts/discourse/views/connectors/evil-trout/hello.js.es6
And it will be wired up automatically.
## The block form
If you use the block form of the outlet, its contents will be displayed
if no connectors are found. Example:
```handlebars
{{#plugin-outlet "hello-world"}}
Nobody says hello :'(
{{/plugin-outlet}}
```
## Disabling
If a plugin returns a disabled status, the outlets will not be wired up for it.
The list of disabled plugins is returned via the `Site` singleton.
**/
var _connectorCache;
function findOutlets(collection, callback) {
var disabledPlugins = Discourse.Site.currentProp('disabled_plugins') || [];
Ember.keys(collection).forEach(function(res) {
if (res.indexOf("/connectors/") !== -1) {
// Skip any disabled plugins
for (var i=0; i 1) {
viewClass = Ember.ContainerView.extend({
childViews: childViews
});
} else {
viewClass = childViews[0];
}
delete options.fn; // we don't need the default template since we have a connector
return Ember.Handlebars.helpers.view.call(this, viewClass, 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()
}),
options);
}
}