Files
DiceCloud/rpg-docs/Routes/Routes.js
Thaum 5e0a912d21 Fixed character sheet having undefined data context on refresh
Added waitOn subscriptions and required publications. Expect a warning about autopublish now.
2014-11-05 12:35:50 +00:00

47 lines
960 B
JavaScript

Router.map( function () {
this.route('home',
{
path: '/',
waitOn: function(){
return Meteor.subscribe("characterList", Meteor.userId());
},
data: {
characters: function(){
return Characters.find()
}
}
});
this.route('character', {
path: '/character/:_id',
notFoundTemplate: 'characterNotFound',
waitOn: function(){
return Meteor.subscribe("singleCharacter", this.params._id, Meteor.userId());
},
data: function() {
var data = Characters.findOne({_id: this.params._id});
return data;
}
});
this.route('inventory', {
path: '/inventory/:_id',
notFoundTemplate: 'characterNotFound',
data: {
containers: function() {
var containers = Containers.find({owner: data._id});
return containers;
},
}
});
this.route('item', {
path: '/item/:_id',
notFoundTemplate: 'itemNotFound',
data: function() {
var data = Items.findOne({_id: this.params._id});
return data;
}
});
});