summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxime Quandalle <maxime@quandalle.com>2015-10-22 18:08:39 +0200
committerMaxime Quandalle <maxime@quandalle.com>2015-10-22 18:13:16 +0200
commitb9d20e04f2f6307c0e708e56d05e25ebc942d2df (patch)
tree80c729c7f97677377edf86a9c78c01af15da6d91
parentaa974aa54ab6e5b7db7450206d12b44ffb3a0306 (diff)
downloadwekan-b9d20e04f2f6307c0e708e56d05e25ebc942d2df.tar.gz
wekan-b9d20e04f2f6307c0e708e56d05e25ebc942d2df.tar.bz2
wekan-b9d20e04f2f6307c0e708e56d05e25ebc942d2df.zip
Display the board name in the page title
Fixes #364
-rw-r--r--.eslintrc1
-rw-r--r--.meteor/packages1
-rw-r--r--.meteor/versions2
-rw-r--r--client/config/router.js23
4 files changed, 27 insertions, 0 deletions
diff --git a/.eslintrc b/.eslintrc
index 081b2a56..c952e5e0 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -78,6 +78,7 @@ globals:
Avatars: true
BlazeComponent: false
BlazeLayout: false
+ DocHead: false
ESSearchResults: false
FlowRouter: false
FS: false
diff --git a/.meteor/packages b/.meteor/packages
index 765932d4..39242f48 100644
--- a/.meteor/packages
+++ b/.meteor/packages
@@ -50,6 +50,7 @@ alethes:pages
arillo:flow-router-helpers
audit-argument-checks
kadira:blaze-layout
+kadira:dochead
kadira:flow-router
meteorhacks:picker
meteorhacks:subs-manager
diff --git a/.meteor/versions b/.meteor/versions
index 9a2087f1..840f09f9 100644
--- a/.meteor/versions
+++ b/.meteor/versions
@@ -60,7 +60,9 @@ http@1.1.1
id-map@1.0.4
idmontie:migrations@1.0.0
jquery@1.11.4
+jsx@0.1.6
kadira:blaze-layout@2.2.0
+kadira:dochead@1.1.0
kadira:flow-router@2.7.0
kenton:accounts-sandstorm@0.1.6
launch-screen@1.0.4
diff --git a/client/config/router.js b/client/config/router.js
index 1cac43a0..0a6958d0 100644
--- a/client/config/router.js
+++ b/client/config/router.js
@@ -88,3 +88,26 @@ _.each(redirections, (newPath, oldPath) => {
}],
});
});
+
+// As it is not possible to use template helpers in the page <head> we create a
+// reactive function whose role is to set any page-specific tag in the <head>
+// using the `kadira:dochead` package. Currently we only use it to display the
+// board title if we are in a board page (see #364) but we may want to support
+// some <meta> tags in the future.
+const appTitle = 'Wekan';
+
+// XXX The `Meteor.startup` should not be necessary -- we don't need to wait for
+// the complete DOM to be ready to call `DocHead.setTitle`. But the problem is
+// that the global variable `Boards` is undefined when this file loads so we
+// wait a bit until hopefully all files are loaded. This will be fixed in a
+// clean way once Meteor will support ES6 modules -- hopefully in Meteor 1.3.
+Meteor.startup(() => {
+ Tracker.autorun(() => {
+ const currentBoard = Boards.findOne(Session.get('currentBoard'));
+ const titleStack = [appTitle];
+ if (currentBoard) {
+ titleStack.push(currentBoard.title);
+ }
+ DocHead.setTitle(titleStack.reverse().join(' - '));
+ });
+});