96 lines
1.8 KiB
JavaScript
96 lines
1.8 KiB
JavaScript
Router.configure({
|
|
loadingTemplate: "loading",
|
|
layoutTemplate: "layout",
|
|
});
|
|
|
|
Router.plugin("ensureSignedIn", {
|
|
only: [
|
|
"profile",
|
|
"characterList",
|
|
]
|
|
});
|
|
|
|
Router.plugin("dataNotFound", {notFoundTemplate: "notFound"});
|
|
|
|
Router.map(function() {
|
|
this.route("/", {
|
|
name: "home",
|
|
onAfterAction: function() {
|
|
document.title = appName;
|
|
},
|
|
});
|
|
|
|
this.route("characterList", {
|
|
path: "/characterList",
|
|
waitOn: function(){
|
|
return subsManager.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 [
|
|
subsManager.subscribe("singleCharacter", this.params._id, Meteor.userId()),
|
|
];
|
|
},
|
|
data: function() {
|
|
var data = Characters.findOne(
|
|
{_id: this.params._id},
|
|
{fields: {_id: 1, name: 1, color: 1, writers: 1, readers: 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";
|
|
},
|
|
});
|
|
|
|
this.route("/changelog", {
|
|
name: "changeLog",
|
|
waitOn: function() {
|
|
return [
|
|
subsManager.subscribe("changeLog"),
|
|
]
|
|
},
|
|
data: {
|
|
changeLogs: function() {
|
|
return ChangeLogs.find({}, {sort: {version: -1}});
|
|
}
|
|
},
|
|
onAfterAction: function() {
|
|
document.title = appName;
|
|
},
|
|
});
|
|
|
|
this.route("/guide", {
|
|
name: "guide",
|
|
onAfterAction: function() {
|
|
document.title = appName;
|
|
},
|
|
});
|
|
});
|