mirror of
https://github.com/flarum/framework.git
synced 2024-12-11 21:43:38 +08:00
Add convenience route generation functions
Many instances throughout the app need to be updated to use these :)
This commit is contained in:
parent
a1c21797fc
commit
f2c07218b0
|
@ -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()
|
||||||
|
});
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user