Skip to content

Commit

Permalink
Routing to a single post page
Browse files Browse the repository at this point in the history
chapter5-3
  • Loading branch information
tmeasday committed Oct 19, 2015
1 parent 6f44634 commit 7b9264d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions client/templates/posts/post_item.html
Expand Up @@ -3,5 +3,6 @@
<div class="post-content">
<h3><a href="{{url}}">{{title}}</a><span>{{domain}}</span></h3>
</div>
<a href="{{pathFor 'postPage'}}" class="discuss btn btn-default">Discuss</a>
</div>
</template>
5 changes: 5 additions & 0 deletions client/templates/posts/post_page.html
@@ -0,0 +1,5 @@
<template name="postPage">
<div class="post-page page">
{{> postItem}}
</div>
</template>
5 changes: 5 additions & 0 deletions lib/router.js
Expand Up @@ -5,3 +5,8 @@ Router.configure({
});

Router.route('/', {name: 'postsList'});

Router.route('/posts/:_id', {
name: 'postPage',
data: function() { return Posts.findOne(this.params._id); }
});

0 comments on commit 7b9264d

Please sign in to comment.