From aa974aa54ab6e5b7db7450206d12b44ffb3a0306 Mon Sep 17 00:00:00 2001 From: Maxime Quandalle Date: Thu, 22 Oct 2015 04:02:12 +0200 Subject: Prefer ES5 methods over underscore utilities MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since 07cc454 (ie the switch to Meteor 1.2) we includes the `es5-shim` polyfill to support methods like `Array.prototype.forEach` in a consistent way across all supported browsers (IE8+). MDG recently released a blog post recommending the use of these native methods instead of underscore [0]. We know follow this recommendation. This commit also favor some ES6 features (argument defaults, destructing assignment) in places where we didn’t use them. [0]: http://info.meteor.com/blog/es2015-get-started --- client/config/accounts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'client/config') diff --git a/client/config/accounts.js b/client/config/accounts.js index df0935f7..d475e6b2 100644 --- a/client/config/accounts.js +++ b/client/config/accounts.js @@ -25,7 +25,7 @@ AccountsTemplates.configure({ }, }); -_.each(['signIn', 'signUp', 'resetPwd', 'forgotPwd', 'enrollAccount'], +['signIn', 'signUp', 'resetPwd', 'forgotPwd', 'enrollAccount'].forEach( (routeName) => AccountsTemplates.configureRoute(routeName)); // We display the form to change the password in a popup window that already -- cgit v1.2.3-1-g7c22 From b9d20e04f2f6307c0e708e56d05e25ebc942d2df Mon Sep 17 00:00:00 2001 From: Maxime Quandalle Date: Thu, 22 Oct 2015 18:08:39 +0200 Subject: Display the board name in the page title Fixes #364 --- client/config/router.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'client/config') 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 we create a +// reactive function whose role is to set any page-specific tag in the +// 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 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(' - ')); + }); +}); -- cgit v1.2.3-1-g7c22