diff --git a/framework/core/js/admin/src/components/BasicsPage.js b/framework/core/js/admin/src/components/BasicsPage.js index 9279ee089..c3654d6cc 100644 --- a/framework/core/js/admin/src/components/BasicsPage.js +++ b/framework/core/js/admin/src/components/BasicsPage.js @@ -82,7 +82,7 @@ export default class BasicsPage extends Component { m.redraw(true); this.$('.BasicsPage-homePage input').select(); }}/> - Custom + Custom ] })} diff --git a/framework/core/js/forum/src/initializers/boot.js b/framework/core/js/forum/src/initializers/boot.js index b8a3d33e3..3b75a0232 100644 --- a/framework/core/js/forum/src/initializers/boot.js +++ b/framework/core/js/forum/src/initializers/boot.js @@ -8,8 +8,6 @@ import mapRoutes from 'flarum/utils/mapRoutes'; import Navigation from 'flarum/components/Navigation'; import HeaderPrimary from 'flarum/components/HeaderPrimary'; import HeaderSecondary from 'flarum/components/HeaderSecondary'; -import FooterPrimary from 'flarum/components/FooterPrimary'; -import FooterSecondary from 'flarum/components/FooterSecondary'; import Composer from 'flarum/components/Composer'; import ModalManager from 'flarum/components/ModalManager'; import AlertManager from 'flarum/components/AlertManager'; @@ -21,14 +19,25 @@ import AlertManager from 'flarum/components/AlertManager'; * @param {ForumApp} app */ export default function boot(app) { + // Get the configured default route and update that route's path to be '/'. + // Push the homepage as the first route, so that the user will always be + // able to click on the 'back' button to go home, regardless of which page + // they started on. + const defaultRoute = app.forum.attribute('defaultRoute'); + + for (const i in app.routes) { + if (app.routes[i].path === defaultRoute) { + app.routes[i].path = '/'; + app.history.push(i, '/'); + } + } + m.startComputation(); m.mount(document.getElementById('app-navigation'), Navigation.component({className: 'App-backControl', drawer: true})); m.mount(document.getElementById('header-navigation'), Navigation.component()); m.mount(document.getElementById('header-primary'), HeaderPrimary.component()); m.mount(document.getElementById('header-secondary'), HeaderSecondary.component()); - m.mount(document.getElementById('footer-primary'), FooterPrimary.component()); - m.mount(document.getElementById('footer-secondary'), FooterSecondary.component()); app.pane = new Pane(document.getElementById('app')); app.drawer = new Drawer(); diff --git a/framework/core/js/forum/src/initializers/routes.js b/framework/core/js/forum/src/initializers/routes.js index 0a075ce74..bd9cf23e0 100644 --- a/framework/core/js/forum/src/initializers/routes.js +++ b/framework/core/js/forum/src/initializers/routes.js @@ -12,7 +12,7 @@ import NotificationsPage from 'flarum/components/NotificationsPage'; */ export default function(app) { app.routes = { - 'index': {path: '/', component: IndexPage.component()}, + 'index': {path: '/all', component: IndexPage.component()}, 'index.filter': {path: '/:filter', component: IndexPage.component()}, 'discussion.id': {path: '/d/:id', component: DiscussionPage.component()}, diff --git a/framework/core/js/forum/src/utils/History.js b/framework/core/js/forum/src/utils/History.js index c52088422..ab30bc490 100644 --- a/framework/core/js/forum/src/utils/History.js +++ b/framework/core/js/forum/src/utils/History.js @@ -10,7 +10,7 @@ * rather than the previous discussion. */ export default class History { - constructor() { + constructor(defaultRoute) { /** * The stack of routes that have been navigated to. * @@ -18,11 +18,6 @@ export default class History { * @protected */ this.stack = []; - - // Push the homepage as the first route, so that the user will always be - // able to click on the 'back' button to go home, regardless of which page - // they started on. - this.push('index', '/'); } /** diff --git a/framework/core/src/Api/Serializers/ForumSerializer.php b/framework/core/src/Api/Serializers/ForumSerializer.php index 41ec3d662..3b13c201e 100644 --- a/framework/core/src/Api/Serializers/ForumSerializer.php +++ b/framework/core/src/Api/Serializers/ForumSerializer.php @@ -31,7 +31,8 @@ class ForumSerializer extends Serializer 'themePrimaryColor' => Core::config('theme_primary_color'), 'canView' => $forum->can($this->actor, 'view'), 'canStartDiscussion' => $forum->can($this->actor, 'startDiscussion'), - 'allowSignUp' => (bool) Core::config('allow_sign_up') + 'allowSignUp' => (bool) Core::config('allow_sign_up'), + 'defaultRoute' => Core::config('default_route') ]; if ($this->actor->isAdmin()) { diff --git a/framework/core/src/Forum/ForumServiceProvider.php b/framework/core/src/Forum/ForumServiceProvider.php index af1aa3392..8a9d8d72e 100644 --- a/framework/core/src/Forum/ForumServiceProvider.php +++ b/framework/core/src/Forum/ForumServiceProvider.php @@ -53,7 +53,7 @@ class ForumServiceProvider extends ServiceProvider $this->app->instance('flarum.forum.routes', $routes = new RouteCollection); $routes->get( - '/', + '/all', 'flarum.forum.index', $this->action('Flarum\Forum\Actions\IndexAction') ); @@ -113,6 +113,14 @@ class ForumServiceProvider extends ServiceProvider ); event(new RegisterForumRoutes($routes)); + + $settings = $this->app->make('Flarum\Core\Settings\SettingsRepository'); + + $routes->get( + '/', + 'flarum.forum.default', + $routes->getRouteData()[0]['GET'][$settings->get('default_route')] + ); } protected function action($class)