Handle case where Pages collection isn't loaded yet (although that should never happen…)

This commit is contained in:
Sacha Greif 2015-04-23 09:12:04 +09:00
parent 067d1eb398
commit 4d9fdf55de

View file

@ -7,11 +7,14 @@ Telescope.config.adminMenu.push({
Telescope.config.preloadSubscriptions.push('pages');
PageController = RouteController.extend({
currentPage: function () {
return Pages.collection.findOne({slug: this.params.slug});
},
getTitle: function () {
return Pages.collection.findOne({slug: this.params.slug}).title;
return this.currentPage() && this.currentPage().title;
},
data: function () {
return Pages.collection.findOne({slug: this.params.slug});
return this.currentPage();
}
});