Skip to content

Instantly share code, notes, and snippets.

@Streemo
Created October 25, 2014 21:32
Show Gist options
  • Save Streemo/6d3c20c8cb0039db6d0d to your computer and use it in GitHub Desktop.
Save Streemo/6d3c20c8cb0039db6d0d to your computer and use it in GitHub Desktop.
Router.configure({
layoutTemplate: 'ApplicationLayout',
notFoundTemplate: 'notFound',
yieldTemplates: {
'header': {to: 'heading'}
}
});
Router.map(function(){
this.route('postsList', {
path: '/',
});
this.route('postPage', {
path: '/posts/:_id',
data: function(){
return {
currentPost: Posts.findOne({_id: this.params._id}),
};
}
});
this.route('postSubmit', {
path: '/submit',
onBeforeAction: function(){
if (!Meteor.userId()){
this.template = 'accessDenied';
} else {
this.template = 'postSubmit';
}
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment