From: zuber Date: Thu, 1 Oct 2009 13:22:11 +0000 (+0200) Subject: Działający przycisk "Odśwież panel" (reload) :-) X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/9a96182c20b31868159f4ddd25bbb46abc4173e3?ds=sidebyside Działający przycisk "Odśwież panel" (reload) :-) --- diff --git a/project/static/js/models.js b/project/static/js/models.js index c333a976..65b9d67b 100644 --- a/project/static/js/models.js +++ b/project/static/js/models.js @@ -56,8 +56,8 @@ Editor.XMLModel = Editor.Model.extend({ this.addObserver(this, 'data', this.dataChanged.bind(this)); }, - load: function() { - if (this.get('state') == 'empty') { + load: function(force) { + if (force || this.get('state') == 'empty') { this.set('state', 'loading'); $.ajax({ url: this.serverURL, @@ -162,8 +162,8 @@ Editor.HTMLModel = Editor.Model.extend({ this.serverURL = serverURL; }, - load: function() { - if (this.get('state') == 'empty') { + load: function(force) { + if (force || this.get('state') == 'empty') { this.set('state', 'loading'); $.ajax({ url: this.serverURL, @@ -215,8 +215,8 @@ Editor.ImageGalleryModel = Editor.Model.extend({ this.pages = []; }, - load: function() { - if (this.get('state') == 'empty') { + load: function(force) { + if (force || this.get('state') == 'empty') { this.set('state', 'loading'); $.ajax({ url: this.serverURL, diff --git a/project/static/js/views/html.js b/project/static/js/views/html.js index 8057138e..a7f02dd4 100644 --- a/project/static/js/views/html.js +++ b/project/static/js/views/html.js @@ -36,7 +36,9 @@ var HTMLView = View.extend({ } }, - reload: function() {}, + reload: function() { + this.model.load(true); + }, dispose: function() { this.model.removeObserver(this); diff --git a/project/static/js/views/panel_container.js b/project/static/js/views/panel_container.js index aead0e77..8d383e1a 100644 --- a/project/static/js/views/panel_container.js +++ b/project/static/js/views/panel_container.js @@ -30,6 +30,7 @@ var PanelContainerView = View.extend({ refreshButtonClicked: function(event) { if (this.contentView) { + console.log('refreshButtonClicked'); this.contentView.reload(); } }, diff --git a/project/static/js/views/xml.js b/project/static/js/views/xml.js index 20e2ee98..caafa715 100644 --- a/project/static/js/views/xml.js +++ b/project/static/js/views/xml.js @@ -35,7 +35,9 @@ var XMLView = View.extend({ $('.xmlview', this.element).height(height); }, - reload: function() {}, + reload: function() { + this.model.load(true); + }, editorDidLoad: function(editor) { $(editor.frame).css({width: '100%', height: '100%'});