Files
DiceCloud/rpg-docs/Routes/Routes.js
2015-04-17 10:35:20 +00:00

67 lines
1.4 KiB
JavaScript

Router.configure({
loadingTemplate: 'loading',
layoutTemplate: 'layout'
});
Router.map( function () {
/*
this.route('home', {
path: '/',
waitOn: function(){
return Meteor.subscribe("characterList", Meteor.userId());
},
data: {
characters: function(){
return Characters.find({}, {fields: {_id: 1}});
}
}
});*/ //add a home route and change characterList route
this.route('characterList', {
path: '/',
waitOn: function(){
return Meteor.subscribe("characterList", Meteor.userId());
},
data: {
characters: function(){
return Characters.find({}, {fields: {_id: 1}});
}
},
onAfterAction: function() {
document.title = appName;
}
});
this.route('characterSheet', {
path: '/character/:_id',
waitOn: function(){
return [
Meteor.subscribe("singleCharacter", this.params._id, Meteor.userId()),
];
},
data: function() {
var data = Characters.findOne({_id: this.params._id}, {fields: {_id: 1, name: 1, color: 1}});
return data;
},
onAfterAction: function() {
var char = Characters.findOne({_id: this.params._id}, {fields: {_id: 1, name: 1, color: 1}});
var name = char.name;
if(name){
document.title = name;
} else {
document.title = appName + "Character";
}
}
});
this.route('loading', {
path: '/loading'
});
this.route('profile', {
path: '/account',
onAfterAction: function() {
document.title = appName + " Account";
}
});
});