X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/9a96182c20b31868159f4ddd25bbb46abc4173e3..0f2caec0a29deb23c912042b2f81473a2b9722e2:/project/static/js/views/panel_container.js diff --git a/project/static/js/views/panel_container.js b/project/static/js/views/panel_container.js index 8d383e1a..6dbddd98 100644 --- a/project/static/js/views/panel_container.js +++ b/project/static/js/views/panel_container.js @@ -19,13 +19,17 @@ var PanelContainerView = View.extend({ selectChanged: function(event) { var value = $('select', this.element.get(0)).val(); var klass = panels[value]; + if (this.contentView) { this.contentView.dispose(); this.contentView = null; } + + if( value != 'empty') { this.contentView = new klass($('.content-view', this.element.get(0)), this.model.contentModels[value], this); - $('.panel-main-toolbar .refresh', this.element.get(0)).attr('disabled', null); + $('.panel-main-toolbar .refresh', this.element.get(0)).attr('disabled', null); + } }, refreshButtonClicked: function(event) {