X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/a3a778ec7c2fe89c4cb48f42be3b0821530199d8..4dae2117bd399c1076973d325c6425e79fda1220:/project/static/js/views/panel_container.js?ds=sidebyside diff --git a/project/static/js/views/panel_container.js b/project/static/js/views/panel_container.js index aead0e77..6dbddd98 100644 --- a/project/static/js/views/panel_container.js +++ b/project/static/js/views/panel_container.js @@ -19,17 +19,22 @@ 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) { if (this.contentView) { + console.log('refreshButtonClicked'); this.contentView.reload(); } },