1 /*globals View render_template panels*/
3 var PanelContainerView = View.extend({
6 template: 'panel-container-view-template',
9 init: function(element, model, template) {
10 this.element = $(element);
12 this.template = template || this.template;
14 this.element.html(render_template(this.template, {panels: panels}));
15 $('select', this.element.get(0)).bind('change.panel-container-view', this.selectChanged.bind(this));
18 selectChanged: function(event) {
19 var view = panels[$('select', this.element.get(0)).val()];
20 var klass = view.klass;
21 console.log(view, klass);
22 if (this.contentView) {
23 this.contentView.dispose();
24 this.contentView = null;
26 this.contentView = new klass($('.content-view', this.element.get(0)), this.model);
27 console.log(this.contentView);
31 $('select', this.element.get(0)).unbind('change.panel-container-view');