make getCurrentTemplate always return string

This commit is contained in:
Sacha Greif 2015-01-27 11:11:14 +09:00
parent 2aab2a49c8
commit 08a4b1f785
2 changed files with 9 additions and 1 deletions

View file

@ -3,8 +3,15 @@ cl = function(something){
};
getCurrentTemplate = function() {
return Router.current().lookupTemplate();
var template = Router.current().lookupTemplate();
// on postsDaily route, template is a function
if (typeof template === "function") {
return template();
} else {
return template;
}
};
t=function(message){
var d=new Date();
console.log("### "+message+" rendered at "+d.getHours()+":"+d.getMinutes()+":"+d.getSeconds());

View file

@ -8,6 +8,7 @@ var coreSubscriptions = new SubsManager({
PostsDailyController = RouteController.extend({
template: function() {
// use a function to make sure the template is evaluated *after* any template overrides
return getTemplate('postsDaily');
},