From 9bea6a52d32c843d277640e42785a8faac583a63 Mon Sep 17 00:00:00 2001 From: Maxime Quandalle Date: Sun, 23 Aug 2015 22:00:02 +0200 Subject: Fix the stars Fixes #214 --- client/components/boards/boardHeader.jade | 4 ++-- client/components/boards/boardHeader.js | 4 ++-- client/components/boards/boardList.jade | 4 ++-- client/components/boards/boardList.js | 14 +++----------- client/components/boards/boardList.styl | 19 ++++++++----------- 5 files changed, 17 insertions(+), 28 deletions(-) diff --git a/client/components/boards/boardHeader.jade b/client/components/boards/boardHeader.jade index 9ec79227..f6ef59c3 100644 --- a/client/components/boards/boardHeader.jade +++ b/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}} diff --git a/client/components/boards/boardHeader.js b/client/components/boards/boardHeader.js index 742d72bc..efe6b5ef 100644 --- a/client/components/boards/boardHeader.js +++ b/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 diff --git a/client/components/boards/boardList.jade b/client/components/boards/boardList.jade index f0dc808f..a6895cc8 100644 --- a/client/components/boards/boardList.jade +++ b/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 diff --git a/client/components/boards/boardList.js b/client/components/boards/boardList.js index f902cc84..e86d16ab 100644 --- a/client/components/boards/boardList.js +++ b/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(); } }]; diff --git a/client/components/boards/boardList.styl b/client/components/boards/boardList.styl index 8a750f43..af66a1a2 100644 --- a/client/components/boards/boardList.styl +++ b/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 -- cgit v1.2.3-1-g7c22