1
0
mirror of https://github.com/flarum/core.git synced 2025-02-17 14:34:59 +01:00

Patch Mithril with a route shortcut attribute

Instead of:

<a href={app.route.user(user)} config={m.route}>

We can use:

<a route={app.route.user(user)}>
This commit is contained in:
Toby Zerner 2015-09-22 17:09:38 +09:30
parent f55d95c9b7
commit f591851cb2
2 changed files with 8 additions and 0 deletions

@ -9,6 +9,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Migration generator, available via generate:migration console command.
- Tags: Ability to set the tags page as the home page.
- `bidi` attribute for Mithril elements as a shortcut to set up bidirectional bindings.
- `route` attribute for Mithril elements as a shortcut to link to a route.
- Abstract SettingsModal component for quickly building admin config modals.
- "Debug" button to inspect the response of a failed AJAX request.

@ -14,6 +14,13 @@ export default function patchMithril(global) {
m.bidi(node, node.attrs.bidi);
}
if (node.attrs.route) {
node.attrs.href = node.attrs.route;
node.attrs.config = m.route;
delete node.attrs.route;
}
return node;
};