Add convenience route generation functions

Many instances throughout the app need to be updated to use these :)
This commit is contained in:
Toby Zerner 2015-05-14 22:22:36 +09:30
parent a1c21797fc
commit f2c07218b0

View File

@ -18,4 +18,20 @@ export default function(app) {
'settings': ['/settings', SettingsPage.component()] 'settings': ['/settings', SettingsPage.component()]
}; };
app.route.discussion = function(discussion, near) {
return app.route(near ? 'discussion.near' : 'discussion', {
id: discussion.id(),
slug: discussion.slug(),
near: near
});
};
app.route.post = function(post) {
return app.route('discussion.near', {
id: post.discussion().id(),
slug: post.discussion().slug(),
near: post.number()
});
};
} }