From 0ce381aa0a64de9a2165843dfe6ee493940f8c26 Mon Sep 17 00:00:00 2001 From: Maxime Quandalle Date: Mon, 31 Aug 2015 23:14:31 +0200 Subject: Fix the horizontal canvas scrolling on card opening --- client/config/router.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'client/config') diff --git a/client/config/router.js b/client/config/router.js index a3d8897d..77b17b63 100644 --- a/client/config/router.js +++ b/client/config/router.js @@ -7,12 +7,12 @@ FlowRouter.route('/', { name: 'home', triggersEnter: [AccountsTemplates.ensureSignedIn], action: function() { - EscapeActions.executeAll(); - Filter.reset(); - Session.set('currentBoard', null); Session.set('currentCard', null); + Filter.reset(); + EscapeActions.executeAll(); + BlazeLayout.render('defaultLayout', { content: 'boardList' }); } }); @@ -21,15 +21,16 @@ FlowRouter.route('/b/:id/:slug', { name: 'board', action: function(params) { let currentBoard = params.id; + let previousBoard = Session.get('currentBoard'); + Session.set('currentBoard', currentBoard); + Session.set('currentCard', null); + // If we close a card, we'll execute again this route action but we don't // want to excape every current actions (filters, etc.) - if (Session.get('currentBoard') !== currentBoard) { + if (previousBoard !== currentBoard) { EscapeActions.executeAll(); } - Session.set('currentBoard', currentBoard); - Session.set('currentCard', null); - BlazeLayout.render('defaultLayout', { content: 'board' }); } }); @@ -37,10 +38,11 @@ FlowRouter.route('/b/:id/:slug', { FlowRouter.route('/b/:boardId/:slug/:cardId', { name: 'card', action: function(params) { - EscapeActions.executeUpTo('inlinedForm'); Session.set('currentBoard', params.boardId); Session.set('currentCard', params.cardId); + EscapeActions.executeUpTo('inlinedForm'); + BlazeLayout.render('defaultLayout', { content: 'board' }); } }); -- cgit v1.2.3-1-g7c22