boardsList.js 675 B

123456789101112131415161718192021222324252627282930
  1. BlazeComponent.extendComponent({
  2. template: function() {
  3. return 'boardList';
  4. },
  5. boards: function() {
  6. return Boards.find({
  7. archived: false,
  8. 'members.userId': Meteor.userId()
  9. }, {
  10. sort: ['title']
  11. });
  12. },
  13. isStarred: function() {
  14. var user = Meteor.user();
  15. return user && user.hasStarred(this.currentData()._id);
  16. },
  17. events: function() {
  18. return [{
  19. 'click .js-add-board': Popup.open('createBoard'),
  20. 'click .js-star-board': function(evt) {
  21. var boardId = this.currentData()._id;
  22. Meteor.user().toggleBoardStar(boardId);
  23. evt.preventDefault();
  24. }
  25. }];
  26. }
  27. }).register('boardList');