Skip to content
Browse files

Display notifications in the header.

  • Loading branch information
tmeasday committed Oct 19, 2015
1 parent a6a68b0 commit 6b09046b785fcb86f263beecf59343f1f01dd8ed
@@ -11,7 +11,14 @@
<div class="collapse navbar-collapse" id="navigation">
<ul class="nav navbar-nav">
{{#if currentUser}}<li><a href="{{pathFor 'postSubmit'}}">Submit Post</a></li>{{/if}}
{{#if currentUser}}
<a href="{{pathFor 'postSubmit'}}">Submit Post</a>
<li class="dropdown">
{{> notifications}}
<ul class="nav navbar-nav navbar-right">
{{> loginButtons}}
@@ -0,0 +1,26 @@
<template name="notifications">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
{{#if notificationCount}}
<span class="badge badge-inverse">{{notificationCount}}</span>
<b class="caret"></b>
<ul class="notification dropdown-menu">
{{#if notificationCount}}
{{#each notifications}}
{{> notificationItem}}
<li><span>No Notifications</span></li>

<template name="notificationItem">
<a href="{{notificationPostPath}}">
<strong>{{commenterName}}</strong> commented on your post
@@ -0,0 +1,20 @@
notifications: function() {
return Notifications.find({userId: Meteor.userId(), read: false});
notificationCount: function(){
return Notifications.find({userId: Meteor.userId(), read: false}).count();

notificationPostPath: function() {
return Router.routes.postPage.path({_id: this.postId});
'click a': function() {
Notifications.update(this._id, {$set: {read: true}});

0 comments on commit 6b09046

Please sign in to comment.
You can’t perform that action at this time.