summaryrefslogtreecommitdiffstats
path: root/client/components/boards/boardList.js
blob: e86d16abd0f1650db999f8ae9e1bc7da621a8aea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
BlazeComponent.extendComponent({
  template: function() {
    return 'boardList';
  },

  boards: function() {
    return Boards.find({}, {
      sort: ['title']
    });
  },

  isStarred: function() {
    var user = Meteor.user();
    return user && user.hasStarred(this.currentData()._id);
  },

  events: function() {
    return [{
      'click .js-add-board': Popup.open('createBoard'),
      'click .js-star-board': function(evt) {
        var boardId = this.currentData()._id;
        Meteor.user().toggleBoardStar(boardId);
        evt.preventDefault();
      }
    }];
  }
}).register('boardList');