Maxime Quandalle 10 лет назад
Родитель
Сommit
9bea6a52d3

+ 2 - 2
client/components/boards/boardHeader.jade

@@ -7,8 +7,8 @@ template(name="headerBoard")
     unless isSandstorm
       if currentUser
         a.board-header-btn.js-star-board(class="{{#if isStarred}}is-active{{/if}}"
-          title="{{#if currentBoard.isStarred}}{{_ 'click-to-unstar'}}{{else}}{{_ 'click-to-star'}}{{/if}} {{_ 'starred-boards-description'}}")
-          i.fa(class="fa-star{{#unless currentBoard.isStarred}}-o{{/unless}}")
+          title="{{#if isStarred}}{{_ 'click-to-unstar'}}{{else}}{{_ 'click-to-star'}}{{/if}} {{_ 'starred-boards-description'}}")
+          i.fa(class="fa-star{{#unless isStarred}}-o{{/unless}}")
           if showStarCounter
             span {{_ 'board-nb-stars' currentBoard.stars}}
 

+ 2 - 2
client/components/boards/boardHeader.js

@@ -29,9 +29,9 @@ BlazeComponent.extendComponent({
   },
 
   isStarred: function() {
-    var currentBoard  = this.currentData();
+    var boardId = Session.get('currentBoard');
     var user = Meteor.user();
-    return currentBoard && user && user.hasStarred(currentBoard._id);
+    return user && user.hasStarred(boardId);
   },
 
   // Only show the star counter if the number of star is greater than 2

+ 2 - 2
client/components/boards/boardList.jade

@@ -6,8 +6,8 @@ template(name="boardList")
           a.js-open-board(href="{{pathFor 'board' id=_id slug=slug}}")
             span.details
               span.board-list-item-name= title
-              i.fa.fa-star-o.js-star-board(
-                class="{{#if isStarred}}is-star-active{{/if}}"
+              i.fa.js-star-board(
+                class="fa-star{{#if isStarred}} is-star-active{{else}}-o{{/if}}"
                 title="{{_ 'star-board-title'}}")
   else
     ul.board-list.clearfix

+ 3 - 11
client/components/boards/boardList.js

@@ -9,25 +9,17 @@ BlazeComponent.extendComponent({
     });
   },
 
-  starredBoards: function() {
-    var cursor = Boards.find({
-      _id: { $in: Meteor.user().profile.starredBoards || [] }
-    }, {
-      sort: ['title']
-    });
-    return cursor.count() === 0 ? null : cursor;
-  },
-
   isStarred: function() {
     var user = Meteor.user();
-    return user && user.hasStarred(this._id);
+    return user && user.hasStarred(this.currentData()._id);
   },
 
   events: function() {
     return [{
       'click .js-add-board': Popup.open('createBoard'),
       'click .js-star-board': function(evt) {
-        Meteor.user().toggleBoardStar(this._id);
+        var boardId = this.currentData()._id;
+        Meteor.user().toggleBoardStar(boardId);
         evt.preventDefault();
       }
     }];

+ 8 - 11
client/components/boards/boardList.styl

@@ -8,8 +8,10 @@
     box-sizing: border-box
     position: relative
 
-    &.starred .fa-star-o
-      opacity: 1
+    &.starred
+      .fa-star,
+      .fa-star-o
+        opacity: 1
 
   a
     background-color: #999
@@ -47,6 +49,7 @@
     :hover
       background-color:#939393
 
+  .fa-star,
   .fa-star-o
     bottom: 0
     font-size: 14px
@@ -61,13 +64,14 @@
     transition-property: color, font-size, background
 
   .is-star-active
-    color: #e6bf00
+    color: white
 
   li:hover a
     color: #f6f6f6
 
+    .fa-star,
     .fa-star-o
-      color: #fff
+      color: white
       opacity: .75
 
       &:hover
@@ -75,15 +79,8 @@
         opacity: 1
 
       &.is-star-active
-        color: #e6bf00
         opacity: 1
 
-        &:hover
-          color: #ffd91a
-          font-size: 16px
-          opacity: 1
-
-
 .board-backgrounds-list
 
   .board-background-select