Mercurial > wikked
changeset 333:861b581749b0
frontend: Fix the history page for the main page when viewed with no URL.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Wed, 11 Mar 2015 15:35:17 -0700 |
parents | 74b849875a57 |
children | be7275021f3a |
files | wikked/assets/js/wikked/models.js |
diffstat | 1 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/wikked/assets/js/wikked/models.js Wed Mar 11 14:43:40 2015 -0700 +++ b/wikked/assets/js/wikked/models.js Wed Mar 11 15:35:17 2015 -0700 @@ -348,6 +348,20 @@ }, _onChangePath: function(model, path) { PageHistoryModel.__super__._onChangePath.apply(this, arguments); + if (path === '') { + // This is the main page. Let's wait until we know its URL, + // and use that instead for all the view data links, because + // most of them require an actual page URL. + this.on('change:url', this._onChangeUrl, this); + return; + } + this._setViewData(path); + }, + _onChangeUrl: function(model, url) { + this.off('change:meta', this._onChangeUrl, this); + this._setViewData(url); + }, + _setViewData: function(path) { this.set({ url_read: '/#/read/' + path, url_edit: '/#/edit/' + path,