summaryrefslogtreecommitdiffstats
path: root/client/components/boards/boardList.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/components/boards/boardList.js')
-rw-r--r--client/components/boards/boardList.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/client/components/boards/boardList.js b/client/components/boards/boardList.js
new file mode 100644
index 00000000..8dc70ee9
--- /dev/null
+++ b/client/components/boards/boardList.js
@@ -0,0 +1,34 @@
+BlazeComponent.extendComponent({
+ template: function() {
+ return 'boardList';
+ },
+
+ boards: function() {
+ return Boards.find({}, {
+ sort: ['title']
+ });
+ },
+
+ starredBoards: function() {
+ var cursor = Boards.find({
+ _id: { $in: Meteor.user().profile.starredBoards || [] }
+ }, {
+ sort: ['title']
+ });
+ return cursor.count() === 0 ? null : cursor;
+ },
+
+ isStarred: function() {
+ var user = Meteor.user();
+ return user && user.hasStarred(this._id);
+ },
+
+ events: function() {
+ return [{
+ 'click .js-star-board': function(evt) {
+ Meteor.user().toggleBoardStar(this._id);
+ evt.preventDefault();
+ }
+ }];
+ }
+}).register('boardList');