Fix the stars

Fixes #214
This commit is contained in:
Maxime Quandalle 2015-08-23 22:00:02 +02:00
parent f03fee5162
commit 9bea6a52d3
5 changed files with 17 additions and 28 deletions

View file

@ -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();
}
}];