Mercurial > wikked
changeset 62:a73a3c0b6d4a
Fixed some bugs with the page state warning.
TODO: still another bug to fix where the state info comes in between the path update and the content update.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Wed, 06 Feb 2013 17:39:03 -0800 |
parents | 130eccd396d8 |
children | 97efd73f2158 |
files | static/js/wikked/views.js |
diffstat | 1 files changed, 11 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/static/js/wikked/views.js Wed Feb 06 08:22:31 2013 -0800 +++ b/static/js/wikked/views.js Wed Feb 06 17:39:03 2013 -0800 @@ -226,13 +226,7 @@ e.preventDefault(); return false; }, - _onModelChange: function() { - PageReadView.__super__._onModelChange.apply(this, arguments); - - // Fetch the state if the current page changed. - if (!this.model.hasChanged('path')) - return; - + _checkPageState: function() { var stateTpl = this.warningTemplate; var stateModel = new Models.PageStateModel({ path: this.model.get('path') }); stateModel.fetch({ @@ -249,6 +243,16 @@ } } }); + }, + _firstRender: true, + _onModelChange: function() { + PageReadView.__super__._onModelChange.apply(this, arguments); + + // Fetch the state if the current page changed. + if (this.model.hasChanged('path') || this._firstRender) { + this._checkPageState(); + this._firstRender = false; + } } });