1
0
mirror of https://github.com/flarum/core.git synced 2025-07-31 13:40:20 +02:00

Remove "custom" home page input

Also add an API to let extensions define additional default route
options.

Allowing default routes with parameters (e.g. /d/123) is very difficult
because of the way Mithril routing works, and it doesn't have a
convincing use-case to justify the trouble. So I've removed the custom
input altogether.

closes #427
This commit is contained in:
Toby Zerner
2015-09-17 12:56:39 +09:30
parent e038c5c9d9
commit dbd33f687c
3 changed files with 37 additions and 18 deletions

View File

@@ -24,14 +24,15 @@ export default function boot(app) {
// able to click on the 'back' button to go home, regardless of which page
// they started on.
const defaultRoute = app.forum.attribute('defaultRoute');
let defaultAction = 'index';
for (const i in app.routes) {
if (app.routes[i].path === defaultRoute) {
app.routes[i].path = '/';
app.history.push(i, '/');
}
if (app.routes[i].path === defaultRoute) defaultAction = i;
}
app.routes[defaultAction].path = '/';
app.history.push(defaultAction, '/');
m.startComputation();
m.mount(document.getElementById('app-navigation'), Navigation.component({className: 'App-backControl', drawer: true}));