Browse Source

My Cards development

* always go to page
* use minicard for displaying cards
* change the icon for my cards menu option
John R. Supplee 4 years ago
parent
commit
a58b27e9b0

+ 2 - 3
client/components/main/myCards.jade

@@ -24,6 +24,5 @@ template(name="myCards")
             | {{_ 'list' }}:
             = list.title
           each card in list.cards
-            .card-title
-              | {{_ 'card' }}:
-              = card.title
+            a.minicard-wrapper.card-title(href="{{pathFor 'card' boardId=board.id slug=board.slug cardId=card._id }}")
+              +minicard(card)

+ 28 - 27
client/components/main/myCards.js

@@ -1,5 +1,4 @@
 const subManager = new SubsManager();
-// import Cards from '../../../models/cards';
 Meteor.subscribe('myCards');
 Meteor.subscribe('mySwimlanes');
 Meteor.subscribe('myLists');
@@ -31,17 +30,6 @@ BlazeComponent.extendComponent({
     // subManager.subscribe('myCards');
   },
 
-  boards() {
-    boards = [];
-    const cursor = Boards.find({
-      archived: false,
-      'members.userId': Meteor.userId(),
-      type: 'board',
-    });
-
-    return cursor;
-  },
-
   cardsFind() {
     const boards = [];
     let board = null;
@@ -63,11 +51,7 @@ BlazeComponent.extendComponent({
       },
     );
     // eslint-disable-next-line no-console
-    console.log('cursor:', cursor);
-    // let card = null;
-    // if (cursor.hasNext()) {
-    //   card = cursor.next();
-    // }
+    // console.log('cursor:', cursor);
 
     let newBoard = false;
     let newSwimlane = false;
@@ -75,10 +59,10 @@ BlazeComponent.extendComponent({
 
     cursor.forEach(card => {
       // eslint-disable-next-line no-console
-      console.log('card:', card.title);
+      // console.log('card:', card.title);
       if (list === null || list.id !== card.listId) {
         // eslint-disable-next-line no-console
-        console.log('new list');
+        // console.log('new list');
         let l = Lists.findOne(card.listId);
         if (!l) {
           l = {
@@ -87,7 +71,7 @@ BlazeComponent.extendComponent({
           };
         }
         // eslint-disable-next-line no-console
-        console.log('list:', l);
+        // console.log('list:', l);
         list = {
           id: l._id,
           title: l.title,
@@ -97,7 +81,7 @@ BlazeComponent.extendComponent({
       }
       if (swimlane === null || card.swimlaneId !== swimlane.id) {
         // eslint-disable-next-line no-console
-        console.log('new swimlane');
+        // console.log('new swimlane');
         let s = Swimlanes.findOne(card.swimlaneId);
         if (!s) {
           s = {
@@ -106,7 +90,7 @@ BlazeComponent.extendComponent({
           };
         }
         // eslint-disable-next-line no-console
-        console.log('swimlane:', s);
+        // console.log('swimlane:', s);
         swimlane = {
           id: s._id,
           title: s.title,
@@ -116,13 +100,14 @@ BlazeComponent.extendComponent({
       }
       if (board === null || card.boardId !== board.id) {
         // eslint-disable-next-line no-console
-        console.log('new board');
+        // console.log('new board');
         const b = Boards.findOne(card.boardId);
         // eslint-disable-next-line no-console
-        console.log('board:', b, b._id, b.title);
+        // console.log('board:', b, b._id, b.title);
         board = {
           id: b._id,
           title: b.title,
+          slug: b.slug,
           swimlanes: [swimlane],
         };
         newBoard = true;
@@ -138,15 +123,31 @@ BlazeComponent.extendComponent({
         list.cards.push(card);
       }
 
-      // card = cursor.hasNext() ? cursor.next() : null;
-
       newBoard = false;
       newSwimlane = false;
       newList = false;
     });
 
     // eslint-disable-next-line no-console
-    console.log('boards:', boards);
+    // console.log('boards:', boards);
     return boards;
   },
+
+  events() {
+    return [
+      {
+        'click .js-my-card'(evt) {
+          const card = this.currentData().card;
+          // eslint-disable-next-line no-console
+          console.log('currentData():', this.currentData());
+          // eslint-disable-next-line no-console
+          console.log('card:', card);
+          if (card) {
+            Utils.goCardId(card._id);
+          }
+          evt.preventDefault();
+        },
+      },
+    ];
+  },
 }).register('myCards');

+ 5 - 4
client/components/main/myCards.styl

@@ -20,11 +20,11 @@
       margin: 5px
 
 .board-title
-  font-size: 1.4em
+  font-size: 1.4rem
   font-weight: bold
 
 .swimlane-title
-  font-size: 1.2em
+  font-size: 1.2rem
   font-weight: bold
   margin-left: 1em
   margin-top: 10px
@@ -32,8 +32,9 @@
 .list-title
   margin-top: 5px
   font-weight: bold
-  margin-left: 1.6em
+  margin-left: 1.6rem
 
 .card-title
   margin-top: 5px
-  margin-left: 1.8em
+  margin-left: 1.8rem
+  max-width: 350px;

+ 1 - 1
client/components/users/userHeader.jade

@@ -15,7 +15,7 @@ template(name="memberMenuPopup")
     with currentUser
       li
         a.js-my-cards(href="{{pathFor 'my-cards'}}")
-          i.fa.fa-user
+          i.fa.fa-list
           | {{_ 'my-cards'}}
       li
         a.js-edit-profile

+ 11 - 11
config/router.js

@@ -125,17 +125,17 @@ FlowRouter.route('/my-cards', {
     Utils.manageCustomUI();
     Utils.manageMatomo();
 
-    if (previousPath) {
-      Modal.open(myCardsTemplate, {
-        header: 'myCardsModalTitle',
-        onCloseGoTo: previousPath,
-      });
-    } else {
-      BlazeLayout.render('defaultLayout', {
-        headerBar: 'myCardsHeaderBar',
-        content: myCardsTemplate,
-      });
-    }
+    // if (previousPath) {
+    //   Modal.open(myCardsTemplate, {
+    //     header: 'myCardsModalTitle',
+    //     onCloseGoTo: previousPath,
+    //   });
+    // } else {
+    BlazeLayout.render('defaultLayout', {
+      headerBar: 'myCardsHeaderBar',
+      content: myCardsTemplate,
+    });
+    // }
   },
 });