summaryrefslogtreecommitdiffstats
path: root/client/components/boards/router.js
blob: 6845b7f2402867120fa97b903fec07961decb6ed (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
31
32
33
34
Meteor.subscribe('boards');

BoardSubsManager = new SubsManager();

Router.route('/boards', {
  name: 'Boards',
  template: 'boards',
  authenticated: true,
  onBeforeAction: function() {
    Session.set('currentBoard', '');
    Filter.reset();
    this.next();
  }
});

Router.route('/boards/:_id/:slug', {
  name: 'Board',
  template: 'board',
  onAfterAction: function() {
    Session.set('sidebarIsOpen', true);
    Session.set('currentWidget', 'home');
    Session.set('menuWidgetIsOpen', false);
  },
  waitOn: function() {
    var params = this.params;
    Session.set('currentBoard', params._id);
    Session.set('currentCard', null);

    return BoardSubsManager.subscribe('board', params._id, params.slug);
  },
  data: function() {
    return Boards.findOne(this.params._id);
  }
});