Skip to content

Commit 7b9264d

Browse files
committedOct 19, 2015
Routing to a single post page
chapter5-3
1 parent 6f44634 commit 7b9264d

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed
 

‎client/templates/posts/post_item.html

+1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
<div class="post-content">
44
<h3><a href="{{url}}">{{title}}</a><span>{{domain}}</span></h3>
55
</div>
6+
<a href="{{pathFor 'postPage'}}" class="discuss btn btn-default">Discuss</a>
67
</div>
78
</template>

‎client/templates/posts/post_page.html

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<template name="postPage">
2+
<div class="post-page page">
3+
{{> postItem}}
4+
</div>
5+
</template>

‎lib/router.js

+5
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,8 @@ Router.configure({
55
});
66

77
Router.route('/', {name: 'postsList'});
8+
9+
Router.route('/posts/:_id', {
10+
name: 'postPage',
11+
data: function() { return Posts.findOne(this.params._id); }
12+
});

0 commit comments

Comments
 (0)