-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Node.js By Example
By :
The last feature that we will add in this chapter is the events attached to some of the created pages. So far, we have comments that are actually normal posts kept in the content collection. We will extend the implementation and create another type of post. These posts will still have a pageId property so that they are different from the feed's posts. However, we will introduce an eventDate variable.
In the frontend, we need a new URL. We should keep the same pattern that contains the ID of the page. This is important because we want to display the events in the right place and we don't want to mix them with the list of the pages. Here is the new route registration:
// frontend/js/app.js
.add('pages/:id/:events', function(params) {
if(userModel.isLogged()) {
var p = new Pages({
data: {
pageId: params.id,
showEvents: true
}
});
showPage(p);
} else {
Router.navigate('login');
}
})The template of...