mirror of
https://github.com/flarum/core.git
synced 2025-02-20 08:04:58 +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:
parent
f55d95c9b7
commit
f591851cb2
@ -9,6 +9,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
- Migration generator, available via generate:migration console command.
|
- Migration generator, available via generate:migration console command.
|
||||||
- Tags: Ability to set the tags page as the home page.
|
- Tags: Ability to set the tags page as the home page.
|
||||||
- `bidi` attribute for Mithril elements as a shortcut to set up bidirectional bindings.
|
- `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.
|
- Abstract SettingsModal component for quickly building admin config modals.
|
||||||
- "Debug" button to inspect the response of a failed AJAX request.
|
- "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);
|
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;
|
return node;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user