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 value = $('select', this.element.get(0)).val();
20 var klass = panels[value];
21 if (this.contentView) {
22 this.contentView.dispose();
23 this.contentView = null;
25 this.contentView = new klass($('.content-view',
26 this.element.get(0)), this.model.contentModels[value]);
30 $('select', this.element.get(0)).unbind('change.panel-container-view');