Document title now set with each route

This commit is contained in:
Thaum
2015-04-17 10:35:20 +00:00
parent 663102718d
commit e94b35564b
3 changed files with 17 additions and 21 deletions

View File

@@ -26,6 +26,9 @@ Router.map( function () {
characters: function(){
return Characters.find({}, {fields: {_id: 1}});
}
},
onAfterAction: function() {
document.title = appName;
}
});
@@ -39,25 +42,15 @@ Router.map( function () {
data: function() {
var data = Characters.findOne({_id: this.params._id}, {fields: {_id: 1, name: 1, color: 1}});
return data;
}
});
this.route('inventory', {
path: '/inventory/:_id',
data: {
containers: function() {
var containers = Containers.find({owner: data._id}, {fields: {_id: 1}});
return containers;
},
}
});
this.route('item', {
path: '/item/:_id',
data: function() {
var data = Items.findOne({_id: this.params._id});
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";
}
}
});
@@ -66,6 +59,9 @@ Router.map( function () {
});
this.route('profile', {
path: '/account'
path: '/account',
onAfterAction: function() {
document.title = appName + " Account";
}
});
});

View File

@@ -1,5 +1,4 @@
<head>
<title>RPG Docs</title>
<meta name="viewport" content="width=device-width initial-scale=1.0, user-scalable=no">
<meta name="mobile-web-app-capable" content="yes">
<link href='https://fonts.googleapis.com/css?family=Roboto:400,300,300italic,400italic,500,500italic,700,700italic,900,900italic,100italic,100&subset=latin,latin-ext' rel='stylesheet' type='text/css'>

View File

@@ -0,0 +1 @@
appName = "Dice Cloud";