From cad7741b54abb405334e12cc63c718c233d69b59 Mon Sep 17 00:00:00 2001 From: Maxime Quandalle Date: Thu, 10 Sep 2015 19:11:19 +0200 Subject: Fix the draft saving feature on card switching --- History.md | 1 + client/components/cards/cardDetails.js | 3 +++ client/config/router.js | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/History.md b/History.md index b4126425..ce02c1d4 100644 --- a/History.md +++ b/History.md @@ -13,6 +13,7 @@ security. It also features the following improvements: by Sandstorm); * Cards multi-selection to facilitate batch actions such as moving all the cards of selection, or attaching a label or a member to them; +* Automatic drafts saving synced with the server; * Keyboard navigation, press `?` to read the list of available shortcuts; * The possibility to restore archived boards, lists, and cards. diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 69e0cfdd..09c99f4e 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -102,6 +102,9 @@ BlazeComponent.extendComponent({ _getUnsavedEditKey() { return { fieldName: 'cardDescription', + // XXX Recovering the currentCard identifier form a session variable is + // fragile because this variable may change for instance if the route + // change. We should use some component props instead. docId: Session.get('currentCard'), }; } diff --git a/client/config/router.js b/client/config/router.js index 76d7b3ad..1cac43a0 100644 --- a/client/config/router.js +++ b/client/config/router.js @@ -40,11 +40,11 @@ FlowRouter.route('/b/:id/:slug', { FlowRouter.route('/b/:boardId/:slug/:cardId', { name: 'card', action(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