discourse/app/assets/javascripts/discourse/views/container.js.es6
2014-07-18 12:20:07 -04:00

27 lines
773 B
JavaScript

export default Ember.ContainerView.extend(Discourse.Presence, {
/**
Attaches a view and wires up the container properly
@method attachViewWithArgs
@param {Object} viewArgs The arguments to pass when creating the view
@param {Class} viewClass The view class we want to create
**/
attachViewWithArgs: function(viewArgs, viewClass) {
if (!viewClass) { viewClass = Ember.View.extend(); }
var view = this.createChildView(viewClass, viewArgs);
this.pushObject(view);
},
/**
Attaches a view with no arguments and wires up the container properly
@method attachViewClass
@param {Class} viewClass The view class we want to add
**/
attachViewClass: function(viewClass) {
this.attachViewWithArgs(null, viewClass);
}
});