Переглянути джерело

Fix the draft saving feature on card switching

Maxime Quandalle 9 роки тому
батько
коміт
cad7741b54
3 змінених файлів з 6 додано та 2 видалено
  1. 1 0
      History.md
  2. 3 0
      client/components/cards/cardDetails.js
  3. 2 2
      client/config/router.js

+ 1 - 0
History.md

@@ -13,6 +13,7 @@ security. It also features the following improvements:
   by Sandstorm);
   by Sandstorm);
 * Cards multi-selection to facilitate batch actions such as moving all the cards
 * Cards multi-selection to facilitate batch actions such as moving all the cards
   of selection, or attaching a label or a member to them;
   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;
 * Keyboard navigation, press `?` to read the list of available shortcuts;
 * The possibility to restore archived boards, lists, and cards.
 * The possibility to restore archived boards, lists, and cards.
 
 

+ 3 - 0
client/components/cards/cardDetails.js

@@ -102,6 +102,9 @@ BlazeComponent.extendComponent({
   _getUnsavedEditKey() {
   _getUnsavedEditKey() {
     return {
     return {
       fieldName: 'cardDescription',
       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'),
       docId: Session.get('currentCard'),
     };
     };
   }
   }

+ 2 - 2
client/config/router.js

@@ -40,11 +40,11 @@ FlowRouter.route('/b/:id/:slug', {
 FlowRouter.route('/b/:boardId/:slug/:cardId', {
 FlowRouter.route('/b/:boardId/:slug/:cardId', {
   name: 'card',
   name: 'card',
   action(params) {
   action(params) {
+    EscapeActions.executeUpTo('inlinedForm');
+
     Session.set('currentBoard', params.boardId);
     Session.set('currentBoard', params.boardId);
     Session.set('currentCard', params.cardId);
     Session.set('currentCard', params.cardId);
 
 
-    EscapeActions.executeUpTo('inlinedForm');
-
     BlazeLayout.render('defaultLayout', { content: 'board' });
     BlazeLayout.render('defaultLayout', { content: 'board' });
   },
   },
 });
 });