From e94b35564b6c6b5316b12c2b7fcc6cc4c8a19418 Mon Sep 17 00:00:00 2001 From: Thaum Date: Fri, 17 Apr 2015 10:35:20 +0000 Subject: [PATCH] Document title now set with each route --- rpg-docs/Routes/Routes.js | 36 ++++++++++++-------------- rpg-docs/client/views/layout/head.html | 1 - rpg-docs/lib/constants/appName.js | 1 + 3 files changed, 17 insertions(+), 21 deletions(-) create mode 100644 rpg-docs/lib/constants/appName.js diff --git a/rpg-docs/Routes/Routes.js b/rpg-docs/Routes/Routes.js index 10b33a8a..cf1b446a 100644 --- a/rpg-docs/Routes/Routes.js +++ b/rpg-docs/Routes/Routes.js @@ -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"; + } }); }); \ No newline at end of file diff --git a/rpg-docs/client/views/layout/head.html b/rpg-docs/client/views/layout/head.html index 4d99b2c5..35b0c237 100644 --- a/rpg-docs/client/views/layout/head.html +++ b/rpg-docs/client/views/layout/head.html @@ -1,5 +1,4 @@ - RPG Docs diff --git a/rpg-docs/lib/constants/appName.js b/rpg-docs/lib/constants/appName.js new file mode 100644 index 00000000..6eaa4048 --- /dev/null +++ b/rpg-docs/lib/constants/appName.js @@ -0,0 +1 @@ +appName = "Dice Cloud"; \ No newline at end of file