summaryrefslogtreecommitdiffstats
path: root/client/components/boards/boardsList.js
blob: 2311e7d0e4ecd10fd3b03372e8b0531e99b0aa25 (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
28
29
30
BlazeComponent.extendComponent({
  template: function() {
    return 'boardList';
  },

  boards: function() {
    return Boards.find({
      archived: false,
      'members.userId': Meteor.userId()
    }, {
      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');