Files
DiceCloud/rpg-docs/Routes/Routes.js
2015-04-29 12:25:51 +02:00

60 lines
1.1 KiB
JavaScript

Router.configure({
loadingTemplate: "loading",
layoutTemplate: "layout",
});
Router.map(function() {
this.route("/", {
name: "home",
});
this.route("characterList", {
path: "/characterList",
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: {name: 1}});
var name = char && char.name;
if (name){
document.title = name;
}
},
});
this.route("loading", {
path: "/loading"
});
this.route("profile", {
path: "/account",
onAfterAction: function() {
document.title = appName + " Account";
},
});
});