# HG changeset patch # User Ludovic Chabant # Date 1426113317 25200 # Node ID 861b581749b0ab288ccadfd4893fbfd70f09d33d # Parent 74b849875a57d1b5bd90f99b634cd9c76b5ad082 frontend: Fix the history page for the main page when viewed with no URL. diff -r 74b849875a57 -r 861b581749b0 wikked/assets/js/wikked/models.js --- 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,