This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Template.bookmark.helpers({ | |
| path: function() { | |
| return Router.path('recipe', { name: this.object }); | |
| }, | |
| recipe: function() { | |
| return RecipesData[this.object]; | |
| }, | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template name="bookmark"> | |
| <a href="{{path}}" class="item-activity"> | |
| <span class="attribution"> | |
| <span class="avatar"> | |
| <img src="{{actor.services.twitter.profile_image_url_https}}" class="image-avatar"> | |
| </span> | |
| <span class="meta"> | |
| <span class="author">{{actor.profile.name}}</span> bookmarked <span class="recipe">{{object}}</span> | |
| </span> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Handlebars.registerHelper('equals', function(a1, a2) { | |
| return a1 === a2; | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {{#each activities}} | |
| {{# if equals this.verb 'cook'}} | |
| {{> activity}} | |
| {{else}} | |
| {{> bookmark}} | |
| {{/if}} | |
| {{else}} | |
| <div class="wrapper-message"> | |
| <div class="title-message">No one is cooking yet!</div> | |
| <div class="subtitle-message">Share that you made a recipe and it will show up here.</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Handlebars.registerHelper('equals', function(a1, a2) { | |
| return a1 === a2; | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| activities: function() { | |
| return Stream.feeds.flat.find({}, {sort: {time: -1}}); | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Global subscriptions | |
| if (Meteor.isClient) { | |
| Meteor.subscribe('news'); | |
| Meteor.subscribe('bookmarkCounts'); | |
| feedSubscription = Meteor.subscribe('Stream.feeds.flat'); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (! this.isSimulation && loc && loc.coords) | |
| activity.place = getLocationPlace(loc); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if(! this.isSimulation) { | |
| var feed = Stream.feedManager.getUserFeed(this.userId); | |
| feed.addActivity({ | |
| 'verb': 'bookmark', | |
| 'actor': 'users:' + Meteor.userId(), | |
| 'object': recipeName, | |
| }).catch(function(reason) { | |
| console.error('failed with reason', reason.error); | |
| }); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Instruct the integration library to add hook handlers | |
| // on creation and removal to add or remove items on the | |
| // getstream.io API: | |
| Stream.registerActivity(Activities, { | |
| activityVerb: 'cook', | |
| activityActorProp: 'userId', | |
| }); |