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'); Telescope.config.preloadSubscriptions.push('pages');
PageController = RouteController.extend({ PageController = RouteController.extend({
currentPage: function () {
return Pages.collection.findOne({slug: this.params.slug});
},
getTitle: function () { getTitle: function () {
return Pages.collection.findOne({slug: this.params.slug}).title; return this.currentPage() && this.currentPage().title;
}, },
data: function () { data: function () {
return Pages.collection.findOne({slug: this.params.slug}); return this.currentPage();
} }
}); });