Merge branch 'master' into view-refactor
[redakcja.git] / project / static / js / views / panel_container.js
index 4823343..e4950ba 100644 (file)
@@ -1,6 +1,6 @@
-/*globals Class render_template panels*/
+/*globals View render_template panels*/
 
 
-var PanelContainerView = Class.extend({
+var PanelContainerView = View.extend({
   element: null,
   model: null,
   template: 'panel-container-view-template',
   element: null,
   model: null,
   template: 'panel-container-view-template',
@@ -16,19 +16,19 @@ var PanelContainerView = Class.extend({
   },
   
   selectChanged: function(event) {
   },
   
   selectChanged: function(event) {
-    var view = panels[$('select', this.element.get(0)).val()];
-    var klass = view.klass;
-    console.log(view, klass);
+    var value = $('select', this.element.get(0)).val();
+    var klass = panels[value];
     if (this.contentView) {
       this.contentView.dispose();
       this.contentView = null;
     }
     if (this.contentView) {
       this.contentView.dispose();
       this.contentView = null;
     }
-    this.contentView = new klass($('.content-view', this.element.get(0)), this.model);
-    console.log(this.contentView);
+    this.contentView = new klass($('.content-view', 
+      this.element.get(0)), this.model.contentModels[value]);
   },
   
   dispose: function() {
     $('select', this.element.get(0)).unbind('change.panel-container-view');
   },
   
   dispose: function() {
     $('select', this.element.get(0)).unbind('change.panel-container-view');
+    this._super();
   }
 });
 
   }
 });