boardList.js 607 B

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